convert date format mm/dd/yy to dd/mm/yy

upasanisandip
Member Posts: 405
hi
How can I convert date from mm/dd/yy format to dd/mm/yy
I need it in one codeunit
thanks
How can I convert date from mm/dd/yy format to dd/mm/yy
I need it in one codeunit
thanks
0
Comments
-
What do you need it for? Are you importing in one format and want to save it in another format?
The FORMAT function might be of help to you.0 -
try this:
d := TODAY;
month:=DATE2DMY(d,2);
day:=DATE2DMY(d,1);
year:=DATE2DMY(d,3);
DateText:=FORMAT(month)+'/'+Format(day)+'/'+Format(year);Regards,
GD0 -
Nah, the format function is much easier. Assuming the date is in a date type variable/field, you can do:
MESSAGE(FORMAT(MyDate,0,'<day,2>/<month,2>/<year4>'));
0 -
Hi,
Please go to the report section and set the SourceExpr. in the properties of date format to FORMAT(TODAY,0,3) or FORMAT(TODAY,0,4). You will get the desired result.Mukesh Sharma0 -
FORMAT is for experts ,Example from C/SIDE Reference Guide is also wrong
Example
This example shows how to use the FORMAT function.
MESSAGE(Text000, FORMAT(-123456.78, 15, 3));
Create the following text constant in the C/AL Globals window:
Text Constant
ENU Value
Text000
'The formatted value: >%1<'
The message window shows:
The formatted value: > 123,456.78 [-XRegards,
GD0 -
And what exactly is your point? FORMAT is just another keyword in C/AL code, you just have to learn how to use it. It sure is easier to program one line of code as opposed to the 5 line snippet for which you have to create additional variables.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