Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

amiumi66
New Contributor III

convert in date & time format

Hi Everyone

I have following call:

LET vDate= Peek('StartD',$(i),TableA)

vDate = 04/06/2017 13:27:15

How can i convert it into:

vDate=2017-04-06T13:27:150Z

1 Solution

Accepted Solutions
MVP
MVP

Re: convert in date & time format

May be this

LET vDate = Date(Date#(Peek('StartD',$(i),TableA), 'MM/DD/YYYY h:mm:ss'), 'MM/DD/YYYYT h:mm:ss0Z');

or

LET vDate = Text(Date(Date#(Peek('StartD',$(i),TableA), 'MM/DD/YYYY h:mm:ss'), 'MM/DD/YYYYT h:mm:ss0Z'));

5 Replies

Re: convert in date & time format

What is the 0Z ??

MVP
MVP

Re: convert in date & time format

May be this

LET vDate = Date(Date#(Peek('StartD',$(i),TableA), 'MM/DD/YYYY h:mm:ss'), 'MM/DD/YYYYT h:mm:ss0Z');

or

LET vDate = Text(Date(Date#(Peek('StartD',$(i),TableA), 'MM/DD/YYYY h:mm:ss'), 'MM/DD/YYYYT h:mm:ss0Z'));

antoniotiman
Honored Contributor III

Re: convert in date & time format

Hi,

I assume Your Timestamp Format is

SET TimestampFormat='MM/DD/YYYY hh:mm:ss[.fff]';

=Replace(Timestamp(vDate,'YYYY-MM-DD_hh:mm:ss0Z'),'_','T') -> 2017-04-06T13:27:150Z

Regards,

Antonio

amiumi66
New Contributor III

Re: convert in date & time format

Hi Sunny

T in middle is not showing up & it is leaving spaces in between.

MVP
MVP

Re: convert in date & time format

Don't need space

LET vDate = =Replace(Date(Date#(Peek('StartD',$(i),TableA), 'MM/DD/YYYY h:mm:ss'), 'MM/DD/YYYY@ h:mm:ss0Z'), '@', 'T');

Tried it with static date

=Replace(Date(Date#('04/06/2017 13:27:15', 'MM/DD/YYYY h:mm:ss'), 'MM/DD/YYYY@ h:mm:ss0Z'), '@', 'T')

Capture.PNG