Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
lovelynyaa
New Contributor

Convert String to Timestamp

I have a string datetime property of this format: 20181030T133100.000 GMT

and I would like to format it into 30/10/2018 13:31 (DD/MM/YYYY hh:mm).

I've checked this forum: How to convert timestamp to date format

and was able to get my result by:

Date(Date#(SUBFIELD(PROPERTYDATETIME,'T',1),'YYYYMMDD'),'DD/MM/YYYY') &' '& Date(Date#(SUBFIELD(SUBFIELD(PROPERTYDATETIME,'T',2),'.',1),'hhmmss'),'hh:mm')

However, is there a better method of using the TimeStamp function of splitting the property up to format the datetime instead?

Thanks!

1 Solution

Accepted Solutions
Partner
Partner

Re: Convert String to Timestamp

use stringfunction to get rid of text "GMT"

then use

=timestamp(date('20181030T133100.000'),'DD/MM/YYYY hh:mm') 

which gives me (you may Format to your dateformat)

3 Replies

Re: Convert String to Timestamp

Try this?

=Date(Date#(Replace(Field,'T',' '),'YYYYMMDD hhmmss.fff'),'DD/MM/YYYY hh:mm')


Or

=Date(Date#(Replace(SubField(Field, ' ',1),'T',' '),'YYYYMMDD hhmmss.fff'),'DD/MM/YYYY hh:mm')

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Partner
Partner

Re: Convert String to Timestamp

use stringfunction to get rid of text "GMT"

then use

=timestamp(date('20181030T133100.000'),'DD/MM/YYYY hh:mm') 

which gives me (you may Format to your dateformat)

lovelynyaa
New Contributor

Re: Convert String to Timestamp

Thanks!

Ended up with this:

timestamp(date(SUBFIELD(PROPERTYDATETIME,' ',1)),'DD/MM/YYYY hh:mm')

was wondering if I was able to use the formatting to get rid of the gmt... but this works and much neater than mine hahas ^^