Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ankitbisht01
Creator
Creator

How to read Timestamp if in string format

if have a inline data , i have taken timestamp as a string now i want to read it so i can convert it into number form or do some calculations on it. code is given below n this is what i am trying to do to make it work.

T1:

load *,

Timestamp(Timestamp#(Date,'DD-MM-YYYY hh:mm:ss TT'),'MM/DD/YYYY hh:mm:ss ') as newDate

;

LOAD * INLINE [Date

"01-02-2015 3:29 PM"

"01-03-2015 11:43 PM"

"01-02-2015 3:29 PM"

];

1 Solution

Accepted Solutions
sasiparupudi1
Master III
Master III

load *,

Timestamp(Timestamp#(Datetime,'DD-MM-YYYY hh:mm TT'),'MM/DD/YYYY hh:mm:ss') as newDate

;

LOAD * INLINE [

Datetime

"01-02-2015 3:29 PM"

"01-03-2015 11:43 PM"

"01-02-2015 3:29 PM"

];

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

hh means that the hours are zero padded. This should work:

Timestamp(Timestamp#(Date,'DD-MM-YYYY h:mm:ss TT'),'MM/DD/YYYY hh:mm:ss ')

If not, then use the Alt() approach:

Timestamp(

  Alt(Timestamp#(Date,'DD-MM-YYYY hh:mm:ss TT'),

  Timestamp#(Date,'DD-MM-YYYY h:mm:ss TT')

  )

,'MM/DD/YYYY hh:mm:ss ')

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
sasiparupudi1
Master III
Master III

load *,

Timestamp(Timestamp#(Datetime,'DD-MM-YYYY hh:mm TT'),'MM/DD/YYYY hh:mm:ss') as newDate

;

LOAD * INLINE [

Datetime

"01-02-2015 3:29 PM"

"01-03-2015 11:43 PM"

"01-02-2015 3:29 PM"

];

ankitbisht01
Creator
Creator
Author

hi, its not working  but thanx for help