Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Date Format in AX

73 views
Skip to first unread message

Eduardo

unread,
Jul 29, 2010, 5:36:38 PM7/29/10
to
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

unread,
Jul 29, 2010, 10:42:29 PM7/29/10
to
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.

F van G

unread,
Jul 30, 2010, 5:42:06 AM7/30/10
to
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;

HassanEl-Meligy

unread,
Aug 15, 2010, 7:07:03 PM8/15/10
to

You have to do it in X++
--
HassanEl-Meligy
0 new messages