Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date Conversion with +GMT

Hi

Im stuck trying to convert this string into a date field:

  

2015-02-20 10:55:14.1840296 +12:00

I can parse the line manually like this:

Date(Left([dv_rowstartdate],10),'DD/MM/YYYY') As Startdate2,

But would prefer not to.

I was trying this:

Date#([dv_rowstartdate], 'YYYY-MM-DD hh.mm.ss.fffffffff GMT') As StartDate1,

Timestamp#([dv_rowstartdate], 'YYYY-MM-DD hh.mm.ss.fffffffff GMT')  as StartdateTime1,

But I know I havent got it quite right.

4 Replies
PrashantSangle

Hi,

try like

Timestamp(timestamp#(trim(subfield([dv_rowstartdate],'+','1')),'YYYY-MM-DD hh:mm:ss.tttttt'))

or

date(date#(trim(subfield([dv_rowstartdate],'+','1')),'YYYY-MM-DD hh:mm:ss.tttttt'),'YYYY-MM-DD hh:mm:ss.tttttt')

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
tamilarasu
Champion
Champion

Hi Shane,


Try the below one and let me know,


Date(Date#( [dv_rowstartdate] ,'YYYY-MM-DD hh:mm:ss[.fffffff] +hh:mm')) as StartDate,

Date(Date#( [dv_rowstartdate] ,'YYYY-MM-DD hh:mm:ss[.fffffff] +hh:mm'))  as StartdateTime1


Note: I just used 7 f's [.fffffff] (Milliseconds) based on your time input time format.

Not applicable
Author

That worked perfect thanks.

Noob question, why are the microseconds in brackets?

tamilarasu
Champion
Champion

It will work even If you remove the square brackets. See the below thread for example.

Including tenths/hundredths of second in Time

Date(Date#( [dv_rowstartdate] ,'YYYY-MM-DD hh:mm:ss.fffffff +hh:mm'))