Convert text into date

kenl
Member Posts: 182
Hello,
I am new to Navision. How to convert a text into date, in format YYYYMMDD ?
eg. "20050121" convert into 2005/01//21
Thanks,
Ken
I am new to Navision. How to convert a text into date, in format YYYYMMDD ?
eg. "20050121" convert into 2005/01//21
Thanks,
Ken
0
Comments
-
-
Hello,
Evaluate give me error.
Date: MyDate
Evaluate(myDate, '20050401');
This gives me a run time error. Seem like evaluate only work when the date format is the same as the window regional setting.
Any idea?
Ken0 -
Of course the format must be same as set in regional settings else the application do not know what is year, month and day... you must convert the string before converting into date... (switch to format ddmmyyyy for example)
DateText := COPYSTR(DateText,7,2)+COPYSTR(DateText,5,2) + COPYSTR(DateText,1,4);
This code convert yyyymmdd to ddmmyyyy for example...0 -
try this:
datMyDate := DMY2DATE( COPYSTR(txtMyDate,7,2), COPYSTR(txtMyDate,5,2), COPYSTR(txtMyDate,1,4));
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hello,
Yeah, we can write our own function for that, just like what you suggest.
I thought it is a very common task in programming, and I thought it should be something build-In function for that, like str2Date(Format).... but there is no such build-In function. Seem like Navision is very lacking of build in function for development.
Anyway, thanks for all of you.
Ken0 -
It is nothing about lacking functionality, it is about date format, that is controlled through system settings, and if you need another format, you must change it... :-) it is simple task and do not need special function for that... keep C/AL functions simple... you have simple tools for complex things...0
-
kenl wrote:Seem like Navision is very lacking of build in function for development.0
-
kenl wrote:<snip>
....I thought it should be something build-In function for that, like str2Date(Format).... but there is no such build-In function.
.... </snip>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