cancel
Showing results for 
Search instead for 
Did you mean: 

How to Format the Soap Timestamp Date properly?

Subha_SwethaNan
Level 2
Dear Team,
I am unable to format the timestamp to datetime.

I used below logics to get the sopaui timestamp format yyyy-MM-dd'T'HH:mm:ss.SSS'Z'

FormatUTCDateTime(Now(); "yyyy-MM-dd")&"T"&FormatUTCDateTime(Now(); "HH:mm:ss")&"Z"
FormatUTCDateTime(Now(); "yyyy-MM-dd'T'HH:mm:ss'Z'"

But the output format is interms of text which is throwing a date parse exception when send it through my request. 

I also used a code stage to get the work done but unfortunately, i didnt work.

Dim MS
MS = format(Now,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
Console.WriteLine(MS)

Please suggest a way to handle this exception. Any help would be highly appreciated.
1 REPLY 1

KaranSareen
Staff
Staff
Hello Subha

Code Stage should work fine in this case. I would suggest you to declare the MS variable with the data type as below

Dim MS as datetime
MS = format(Now,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")

After this, MS would be treated as a datetime variable and not text. Please let me know in case you have any other query.