How to Format Date in MS Dynamics NAV 2017 using C/AL Code?
We generally use Format for two reasons in MS Dynamics NAV :-
1. To convert Integer Type Data in String Format.
FORMAT(Integer Type DATA);
2. To Format Date Type Variable in Navision to convert it into desired date Form.
FORMAT(TODAY,0,4)
Today I got a requirement from my client to change the Indian Date format in DDMMYYYY only
for Example 02052017. So to get this done I had used these formulas and format available in Navision.
For Dates, the Regional and Language Options in Windows is used to select the actual format that is used. The table below shows the Fields that will be used to build the various formats. This table, incidentally, corresponds to the Regional setting for a European country/region. | ||
Date
|
Format
|
Example
|
<Closing><Day,2>-<Month,2>-<Year>
|
0
|
05-04-03
|
<Closing><Day,2>-<Month,2>-<Year>
|
1
|
05-04-03
|
<Day,2><Month,2><Year><Closing>D
|
2
|
050403D
|
<Closing><Year>-<Month,2>-<Day,2>
|
3
|
03-04-05
|
<Closing><Day>. <Month Text>
<Year4>
|
4
|
5. April 2003
|
<Closing><Day,2><Month,2><Year>
|
5
|
050403
|
<Closing><Year><Month,2><Day,2>
|
6
|
030405
|
<Day,2><Filler Character, >. <Month
Text,3> <Year4>
|
7
|
5. Apr 2003
|
XML format
|
9
|
2003-04-05
|
The following table shows how these formats will change if the Regional and Language Options is set to "United States." | ||
US Date
|
Format
|
Example
|
<Closing><Month,2>/<Day,2>/<Year>
|
0
|
04/05/03
|
<Closing><Month,2>/<Day,2>/<Year>
|
1
|
04/05/03
|
<Month,2><Day,2><Year><Closing>D
|
2
|
040503D
|
<Closing><Year>/<Month,2>/<Day,2>
|
3
|
03/04/05
|
<Month Text> <Closing><Day>,
<Year4>
|
4
|
April 5, 2003
|
<Closing><Month,2><Day,2><Year>
|
5
|
040503
|
<Closing><Year><Month,2><Day,2>
|
6
|
030405
|
<Day,2><Filler Character, >.
<Month Text,3> <Year4>
|
7
|
5. Apr 2003
|
I hope this post will help in major development of NAVISION.
For more information kindly refer to :-
No comments:
Post a Comment