Question Status

Suggested Answer
Alan Pompilho asked a question on 24 Jul 2009 6:26 AM

Good morning friends, 
 
I am inexperienced in the world of AX and I have a problem here, I created a Job to import a register of a file. txt, here everything certain, but my date field is with the inverted format, when it is converted of anytype for date: Example: 
 
Field of the date of the file. txt               after having converted inside of the variable type dates 
22/07/09                                                                  9/7/2022  
Format: D/M/Y                                                  


conversion method:       VarDate = any2date(conpeek(curretLine,#Date)) ;

in the moment that is converted by the function, any2date she acquires the date in the format Y/M/D, (but the date that this in the format D/M/Y in the. txt) and later in my database he assumes the format D/M/Y, creating this this inversion of the position of the value of D with Y.

 I would like to know if a method exists to convert the anytype maintaining the format D/M/Y ???

Thanks

Reply
Suggested Answer
StevenK responded on 22 May 2013 9:12 PM

Hello Alan, I believe you are looking for something like this

static void Job1(Args _args)

{

   str     myDate = "22/07/09";

   date    myConvertedDate;

   myConvertedDate = str2DateDMY(myDate);

   info(date2str(myConvertedDate, -1,-1,-1,-1,-1,-1));

}

Regards,

Steve

Reply
Mahmoud ElKerdawy responded on 22 May 2013 1:12 PM

why don't you try get the date on a string variable then convert it to date

Reply
Suggested Answer
StevenK responded on 22 May 2013 9:12 PM

Hello Alan, I believe you are looking for something like this

static void Job1(Args _args)

{

   str     myDate = "22/07/09";

   date    myConvertedDate;

   myConvertedDate = str2DateDMY(myDate);

   info(date2str(myConvertedDate, -1,-1,-1,-1,-1,-1));

}

Regards,

Steve

Reply
André Arnaud de Calavon responded on 22 May 2013 10:04 PM

Guys,

This post is from the year 2009. I think Alan already knows how to achieve this?

kind regards,

André Arnaud de Calavon  |  Microsoft Dynamics AX Solution architect  |  My blog  |  My company

This post is my own opinion and does not necessarily reflect the opinion or view of my company, Microsoft, both its employees, or other MVPs.

Reply