String to Date Conversion

roshanthapa
Member Posts: 90
I have developed a program to convert gregorian date to islamic and vice-versa. I had to make certain calculations on the day, month and year.....
Now I have the date in three variables say, day, month and year. And I have to concatenate this and convert to date type...... This is where the problem is. How should I concatenate the day, month and time so that it's in the correct format as the system can accept.
Supporting example:
If I concatenate them as dd/mm/yy then and the systems date format is mm/dd/yy, the system will generate error for dd=20 (date), because when I concatenated, it went to the place where month should be..... so it has to be dynamic as according to the date format of the system. Is there any method to get the date format of the system???
Now I have the date in three variables say, day, month and year. And I have to concatenate this and convert to date type...... This is where the problem is. How should I concatenate the day, month and time so that it's in the correct format as the system can accept.
Supporting example:
If I concatenate them as dd/mm/yy then and the systems date format is mm/dd/yy, the system will generate error for dd=20 (date), because when I concatenated, it went to the place where month should be..... so it has to be dynamic as according to the date format of the system. Is there any method to get the date format of the system???
0
Comments
-
at the beginnig of your process, You can read the virtual table "date" line by line until you find a date with month > 12. If you find one, exit the loop and valorize a boolean (in this case the format is mmddyy) otherwise don't valorize the boolean (because the format is ddmmyy).
then when you have to valorize the date you can refer to the value of the boolean and select the correct format.
this method function only with non-empty DB.
It's a nice workaround as I don't know how to get the regional settings of windows...:oops:
0 -
Now, I have developed another algorithm to tackle this problem and its fast too... Now I don't need the regional settings too.
I soved it!!!0 -
And do not forget that you have DMY2DATE function to create date from Day, Month and Year values... ;-)0
-
Thanks Kine, thanx for reminding me about this function..... This saved my time. I didn't know this function, Now I'll check the whole help file for these kinda functions....
Thanks again....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