How do I merge two Date and time attributes?

I have two date and time fields that I like to merge. From one DateTime I need the date, of the other DateTime only the time. for example: 1/1/1970 14:30 and 11/05/2017 00:00   How do I merge these two such that I can get 11/05/2017 14:30? Thank you in advance
1 answers

Hi Mark,

One way to do it is to use a combination of parseDateTime and formatDateTime


​e.g. you have two DateTime variables $Date and $Time
and you want to take the date component from $Date and the time component from $Time

$DateTime = parseDateTime(formatDateTime($Date,'MM-dd-yyy')+' '+formatDateTime($Time,'hh:mm:ss'),'MM-dd-yyy hh:mm:ss')

Not sure if you need to use the UTC versions of parse and format or not, I guess it would depend on whether your dateTime attributes are localized.

I hope this helps,


Disclaimer: I haven't tested this. :)