Discussion:
Date Format in AX
(too old to reply)
Eduardo
2010-07-29 21:36:38 UTC
Permalink
Hi,

I'm experiencing a problem that is driving me nuts. Basically, I'm sending
an email to a user upon purchase order posting.

I have a method that retrieves the date from the VendPurchOrderTrans and
then it will inject them into the email template I created.

The date I want to show in the email should be in following format: 6/25/2010.

Instead I get 2010/25/6 and I truly don't know how to do it in X++.

Is this an X++ format solution or is this something related to a place holder?

Thank you!
sams9
2010-07-30 02:42:29 UTC
Permalink
Hi Eduardo,
Try any of these three suggestions
1) strFmt("%1", myDate))
2) date2Str(dateType, 123, -1, -1, -1, -1, -1, -1) this will use the users
regional settings which can be different between users.
3) Most flexible way date2Str(dateType, 123, DateDay::Digits2,
DateSeparator::Slash, DateMonth::Digits2, DateSeparator::Slash,
DateYear::Digits4), change the enum values to your preferred format. Have a
look here: http://msdn.microsoft.com/en-us/library/aa857241.aspx.
Post by Eduardo
Hi,
I'm experiencing a problem that is driving me nuts. Basically, I'm sending
an email to a user upon purchase order posting.
I have a method that retrieves the date from the VendPurchOrderTrans and
then it will inject them into the email template I created.
The date I want to show in the email should be in following format: 6/25/2010.
Instead I get 2010/25/6 and I truly don't know how to do it in X++.
Is this an X++ format solution or is this something related to a place holder?
Thank you!
F van G
2010-07-30 09:42:06 UTC
Permalink
Hi,

Please take a look at the following (global) method

str date2Str(
date date,
int sequence,
int day,
int separator1,
int month,
int separator2,
int year)

From the help, here an example:

The following example prints today's date in the format day/month/year, with
2 digits for each of the values.
static void date2StrExample(Args _arg)
{
date d = today();
str s;
;
s = date2Str(d, 123, 2, -1, 2, -1, 2);
print "Today's date is " + s;
pause;
}
Post by Eduardo
Hi,
I'm experiencing a problem that is driving me nuts. Basically, I'm sending
an email to a user upon purchase order posting.
I have a method that retrieves the date from the VendPurchOrderTrans and
then it will inject them into the email template I created.
The date I want to show in the email should be in following format: 6/25/2010.
Instead I get 2010/25/6 and I truly don't know how to do it in X++.
Is this an X++ format solution or is this something related to a place holder?
Thank you!
HassanEl-Meligy
2010-08-15 23:07:03 UTC
Permalink
You have to do it in X++
--
HassanEl-Meligy
Post by Eduardo
Hi,
I'm experiencing a problem that is driving me nuts. Basically, I'm sending
an email to a user upon purchase order posting.
I have a method that retrieves the date from the VendPurchOrderTrans and
then it will inject them into the email template I created.
The date I want to show in the email should be in following format: 6/25/2010.
Instead I get 2010/25/6 and I truly don't know how to do it in X++.
Is this an X++ format solution or is this something related to a place holder?
Thank you!
Loading...