Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
OmarBenSalem

Timestamp format ("2017-12-21T13:33:25.494Z")

Hi all,

Does anybody know how to write such a timestamp format in Qlik?

"2017-12-21T13:33:25.494Z"

with the T and Z?

6 Replies
Chanty4u
MVP
MVP

hi,

the timestamp you got from by web service?

read below :

The T doesn't really stand for anything. It is just the separator that the ISO 8601 combined date-time format requires. You can read it as an abbreviation for Time.

The Z stands for the Zero timezone, as it is offset by 0 from the Coordinated Universal Time (UTC).

Both characters are just static letters in the format, which is why they are not documented by the datetime.strftime() method. You could have used Q or M or Monty Python and the method would have returned them unchanged as well; the method only looks for patterns starting with % to replace those with information from the datetime object.

OmarBenSalem
Author

Yep; you saw it right !

It's from a web service !

So

timestamp(Now(),'YYYY-MM-DD hh:mm:ss.ff')

would do the trick?

Chanty4u
MVP
MVP

yes it will  i think.

in python here the script

x.strftime("%Y-%m-%dT%H:%M:%S%Z")
'2015-03-26T10:58:51'

Chanty4u
MVP
MVP

or you can try with

purgechar() in  timestamp to exclude that  then you will get exact output.

OmarBenSalem
Author

I'm trying to send data to the web service not pull from it.

So I have to format my dates the right way to send them

mhenning
Partner - Contributor II
Partner - Contributor II

SET TimestampFormat='YYYY-MM-DD h:mm:ss[.fff]';

timestamp(date(left(TIMESTAMPFIELD),10)) & ' ' & mid(TIMESTAMPFIELD,12,8))
as _TIMESTAMP