Skip to main content

Hello,

I am trying to format a date field on the results grid on a GI to be MMDDYY with no dashes or slashes I.e.

06/01/2022  should be formatted 060122, is there a way to convert with formatting or function?

Any help would be greatly appreciate it.

  

Hi @alexk95  We can do that with the below formula. You can replace the SOOrder.OrderDate with APPayment.DocDate.

 

= Concat( CStr(Month(tSOOrder.OrderDate])) , CStr(Day( ySOOrder.OrderDate])) ,CStr(Year(aSOOrder.OrderDate])))

 

 


Naveen,

Thank you so much for your prompt reply! , just what I needed , it was almost there with the exeption that I needed something like this , for 06/15/2022  I needed to display 061522 so I modified the statement slightly , I am posting this so it might help someone else in the future.

New revised statement 

=Concat(IIf(Month(tAPPayment.DocDate]) < 10, '0'+CStr(Month(tAPPayment.DocDate])), CStr(Month(tAPPayment.DocDate]))) + IIf(Day(aAPPayment.DocDate]) < 10, '0'+CStr(Day(aAPPayment.DocDate])), CStr(Day(aAPPayment.DocDate]))) + Substring(CStr(Year(aAPPayment.DocDate])),3,2) )

It returns values as below ……

 


Thanks for this.  I have to create the same thing for us.  Our difference is ours requires a / between the dates.  So mine is:

Returns:  05/04/2023

=Concat(IIf(Month(nAPPayment.DocDate]) < 10, '0'+CStr(Month(nAPPayment.DocDate])), CStr(Month(nAPPayment.DocDate]))) + '/' + IIf(Day(DAPPayment.DocDate]) < 10, '0'+CStr(Day(DAPPayment.DocDate])), CStr(Day(DAPPayment.DocDate]))) + '/' + CStr(Year(eAPPayment.DocDate]) ))

 


Here is another option using PadLeft. It simplifies the formula slightly.

=Concat(PadLeft(CStr(MONTH([APPayment.DocDate])), 2, '0'), PadLeft(CStr(DAY([APPayment.DocDate])), 2, '0'), Substring(CStr(Year([APPayment.DocDate])),3,2))

 

Breaking this down into the different parts:

=Concat(  -- Combines the various strings together

PadLeft(CStr(MONTH(HAPPayment.DocDate])), 2, '0'), -- MONTH: Extracts the month from DocDate, CSTR: Converts it to a string value, PADLEFT: Ensures it is 2 characters wide with ‘0’ placed at the left to accomplish this

PadLeft(CStr(DAY(rAPPayment.DocDate])), 2, '0'), -- DAY: Extracts the day from DocDate, CSTR: Converts it to a string value, PADLEFT: Ensures it is 2 characters wide with ‘0’ placed at the left to accomplish this

Substring(CStr(Year(CAPPayment.DocDate])),3,2) -- YEAR: Extracts the year from DocDate, CSTR: Converts it to a string value, SUBSTRING: Extracts the characters starting at position 3, 2 characters

)

 

For those looking to follow the ISO 8601 standard, here is a formula for that.

=Concat(PadLeft(CStr(YEAR((APPayment.DocDate])), 4, '0'), PadLeft(CStr(MONTH(CAPPayment.DocDate])), 2, '0'), PadLeft(CStr(DAY(tAPPayment.DocDate])), 2, '0'))


Reply