Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert to Date format/Multiple timestamps

HI all,

anyone can help to convert below format to standard date format? I used several approaches but I was not successfull. Thanks

The input format is here:

Thu 02-Feb 08:03 PST  |  Thu 02-Feb 16:03 CET  |  Thu 02-Feb 23:03 SGT

Thank you for help

Martina

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

try like

LOAD EXTRACT_TS,

  DATE(Date#(mid(trim(subfield(EXTRACT_TS,'|',1)),5,6),'DD-MMM'),'DD-MM')&'-'&Year(today()) as Extract_DATE,

     Business_Group,

     Business_Sub_Group, ..........your usual load

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

19 Replies
MK_QSL
MVP
MVP

What output you are expecting?

Year is not mentioned here... Do you want to link this to current year?

Anonymous
Not applicable
Author

Output format desired ideally 'MM/DD/YYYY' where Year is always current year. thanks

surendraj
Specialist
Specialist

In text box...

Try with

=(Date(date#(SubField('Thu 02-Feb 08:03 PST',' ',2),'DD-MMM'),'DD-MM'))&'-'&Year(today())

vinieme12
Champion III
Champion III

Try as below

LOAD *,DATE(Date#(subfield(left(TIMESTAMPIS,len(TIMESTAMPIS)-10),' ',2),'DD-MMM'),'MM/DD/'&year(today())) as DateIS INLINE [

TIMESTAMPIS

Thu 02-Feb 08:03 PST

Thu 02-Feb 16:03 CET

Thu 02-Mar 23:03 SGT

];

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sdmech81
Specialist
Specialist

HI,

Use String modification function(like Left,right,mid,subfield) inside Date function(Date,Timestamp etc) to sort this out.

Because your date is not in proper format so QLik qill treat it as string so you have to make it as date as said above..Hope it helps

Sachin

Anonymous
Not applicable
Author

Will this work when each load would have different content? Its not always exactly 2nd Feb. This was just example

Thanks

vinieme12
Champion III
Champion III

Yep it'll work

Change the dates and try

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

Thank you but apparently Im doing something wrong, not sure. I tried renaming "timestampis" to my column header, did not work.

Even still Im loading data for 2nd Feb & 6th Feb but scipt rolls result only for 2nd feb.

Thanks again

surendraj
Specialist
Specialist

Please load the .xls file for testing..to check wheather the dates are formated correct or not.