Another date conversion

iballan
Member Posts: 9
I need to impor dates like these in a general jounal
1. Nov 2010 13:55:59
31. Oct 2010 22:54:11
hov can i convert them to date in NAV. I want to use copystr, but i can't because the lenght is variable.
1. Nov 2010 13:55:59
31. Oct 2010 22:54:11
hov can i convert them to date in NAV. I want to use copystr, but i can't because the lenght is variable.
0
Comments
-
Use STRPOS to find out at what position the spaces are, and then use COPYSTR with that info to copy the data into your Day, Month, Year variables.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
Those values look like datetimes.
You can do:EVALUATE(YourDateTimeVar,yourTextvar); YourDateVar := DT2DATE(YourDateTimeVar); YourTimeVar := DT2Time(YourDateTimeVar);
Where :
YourTextVar is a variable of type Text(80)
YourDateTimeVar is a variable of type DateTime
YourDateVar is a variable of type Date
YourTimeVar is a variable of type Time.
See if this works for you,
Regards,
WillyFostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.0 -
something like:
txtTheDateTime = '1. Nov 2010 13:55:59'; EVALUATE(intDay,COPYSTR(txtTheDateTime,1,STRPOS(txtTheDateTime,'.') - 1)); txtTheDateTime := COPYSTR(txtTheDateTime,1,STRPOS(txtTheDateTime,'.') + 1); CASE UPPERCASE(COPYSTR(txtTheDateTime,1,STRPOS(txtTheDateTime,' ') - 1)) OF // the second parameter of STRPOS is a blank! 'JAN': LintMonth := 1; 'FEB': LintMonth := 2; ... END; txtTheDateTime := COPYSTR(txtTheDateTime,1,STRPOS(txtTheDateTime,' ') + 1); EVALUATE(intYear,COPYSTR(txtTheDateTime,1,STRPOS(txtTheDateTime,' ') - 1)); // the second parameter of STRPOS is a blank! datTheDate := DMY2DATE(intDay,intMonth,intYear);
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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