Dealing with Amazon MP Date Formats

Miklos_Hollender
Member Posts: 1,598
An Amazon Marketplace VAT Calculation report no matter in what language you download it, lists dates as "30-Jan-2020 UTC" which cannot possibly be EVALUATED into a NAV 2015 Date or Datetime in a German settings computer. I suppose I have to do string processing with the month names in a CASE statement and all that. Just asking if someone already wrote that function so I can save that effort. I am not the first one to sell stuff on Amazon and needing to import their data into NAV, right?

0
Answers
-
My first take:
Date Test - OnAction() MESSAGE(FORMAT(AMDate('23-Oct-2019 UTC'))); MESSAGE(FORMAT(AMDate('01-Mar-2020 UTC'))); MESSAGE(FORMAT(AMDate('04-May-2020 UTC'))); LOCAL AMDate(TestText : Text) : Date //get rid of " UTC" ShortenedText := COPYSTR(TestText,1,STRLEN(TestText)-4) ; //parse into text DayTxt := COPYSTR(ShortenedText,1,2); MonthLongTxt := COPYSTR(ShortenedText,4,3); YearTxt := COPYSTR(ShortenedText,8,4); //MESSAGE('Day:'+DayTxt+' Month:'+MonthLongTxt+' Year:'+YearTxt); //parse into int EVALUATE(DayInt,DayTxt); CASE MonthLongTxt OF 'Jan': MonthInt :=1; 'Feb': MonthInt :=2; 'Mar': MonthInt :=3; 'Apr': MonthInt :=4; 'May': MonthInt :=5; 'Jun': MonthInt :=6; 'Jul': MonthInt :=7; 'Aug': MonthInt :=8; 'Sep': MonthInt :=9; 'Oct': MonthInt :=10; 'Nov': MonthInt :=11; 'Dec': MonthInt :=12; END; EVALUATE(YearInt,YearTxt); //MESSAGE('Day:'+DayTxt+' Month:'+format(monthint)+' Year:'+YearTxt); EXIT( DMY2DATE(DayInt,MonthInt,YearInt) );
Works as long as the day is '01' and not '1'...0 -
Nice, I might need that later.
//get rid of " UTC" ShortenedText := COPYSTR(TestText,1,STRLEN(TestText)-4) ;
is basically deadcode, result will be the same if you get rid of that line.Works as long as the day is '01' and not '1'...//split at '-' and space CommaSeparatedTxt := CONVERTSTR(TestText,'- ',',,'); DayTxt := SELECTSTR(1,CommaSeparatedTxt); MonthLongTxt := SELECTSTR(2,CommaSeparatedTxt); YearTxt := SELECTSTR(3,CommaSeparatedTxt);
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions