cancel
Showing results for 
Search instead for 
Did you mean: 

dateformat doesn't work with DateTime?

Former Member
0 Kudos

I have the following code in the Message Property of a tracer:

dateformat(

dateaddmonths(monthstart(Transaction.startDate),ForNextRepeater_0.CurrentItem - 1),

"yyyy-mm-dd Thh:mm:ss", "yyyy-mm-dd")

But dateFormat ends up returning nothing, it returns a " " for some reason

Without the dateformat part in there, it works fine.

Transaction.startDate is a DateTime

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Check your date format strings

[http://help.sap.com/saphelp_xmii120/helpdata/en/45/cca60593696f74e10000000a1553f6/content.htm|http://help.sap.com/saphelp_xmii120/helpdata/en/45/cca60593696f74e10000000a1553f6/content.htm]

Answers (1)

Answers (1)

Former Member
0 Kudos

apnahas,

looking at you "fromdate" part of the dateformat function, it seems that you are using a date like its delivered from the datenow function. The format is something like "2003-07-01T04:00:00". The corresponding format string for this is "yyyy-MM-ddTHH:mm:ss" (without a space in front of "T"). Maybe this is what you are looking for?

Michael

Former Member
0 Kudos

The "T" is a literal so I think it should look like this:

yyyy-MM-dd'T'HH:mm:ss

If the date is in xml format, then you can just use this function:

datefromxmlformat( datetime, toformat )