Date format

Hy

I have this C/AL for a date format:

txtFormatString := ‘<Day,2>/<Month,2>/<Year,2>’;
FechaSincronizacion2 := recSalesReceivables.“Last date import”;
FechaSincronizacion := FORMAT(FechaSincronizacion2,0,txtFormatString);

and the result is = 24/05/10

But I want the date format to be like: 24/05/2010

If I change this C/AL line

txtFormatString := ‘<Day,2>/<Month,2>/<Year,2>’; to txtFormatString := ‘<Day,2>/<Month,2>/<Year,4>’;

The the result is = 24/05/0010 :frowning:

How can I do It??

Hi Luna

use DATE2MY function like below

d := TODAY;
day := DATE2DMY(d,1);
month := DATE2DMY(d,2);
year := DATE2DMY(d,3);
MESSAGE(Text000,day,month,year);  """ *instead of this message concatinate your result  """""*

*Thanks*
*Jerome Marshal.J*

Hi Luana,

Try with instead of <Year,4>.

Thanks

[:^)] - never seen this solution before…

how to get now??

FORMAT(TODAY,0,’<Month,2><Day,2>’) → today

how to get like this 01012010123055 → date + time

thanks

Hi Stan,

Try,

FORMAT(,0,’<Day,2><Month,2><Minutes,2><Seconds,2>’)

Look at the help for “Format Property”

yeah yeah… i already see the format property

i use this FORMAT(TODAY,0,’<Month,2><Day,2><Minutes,2><Seconds,2>’)

but it was said invalid format property :frowning:

Hi Stan,

Sorry I should have put in

FORMAT(CURRENTDATETIME,0,’<Day,2><Month,2><Minutes,2><Seconds,2>’)

TODAY - is a date function whereas

CURRENTDATETIME - is a datetime function.

Dave,it works !!!

thanks for your help :slight_smile:

Stan for more details you can check it out following thing.

Open Classic Client than go to help and select C/SIDE Reference Guide… In this search for FORMAT Property . You will find that how to FORMAT method for available DataTypes.

owww okay

thanks a lot :slight_smile: