Trouble using datetime_format

I am using the example from the TG website:

PRINT start[datetime_format(start.postTime, “a message was posted at %H:%M:%S on %Y/%m/%d”) as postTimeMsg];

I believe I am doing everything correctly, and yet I get this error:


1 Like

Hopefully its not an issue with the DATETIME value being an ACCUM rather than an attribute on the vertex. If datetime_format doesnt handle accumulators, that would be very limiting in its usability.

Hi Mark,

I believe you are referring to datetime_format function. This is a known issue that we are improving.

I am checking is is there a workaround for this. Please stay tuned.


Please see if workaround below works for you.

to_string(year(dt)) + “-” + to_string(month(dt)) + “-” + to_string(day(dt) + " " + to_string(hour(dt)) + “:” + to_string(minute(dt)) + “:” to_string(second(dt))


i want to convert “2021-08-16 14:05:57” this to “2021-08-16” and its not working for me

you can achieve that using combination of to_datetime and datetime_format. Please post the code that you are using and we can figure out why its not working.

for instance - i would use something like this

STRING x_date;
DATETIME startDate;
startDate = to_datetime(“2021-08-16 14:05:57”);

x_date = datetime_format(startDate,"%Y-%m-%d")


thanks. it works for me

1 Like