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: 
Anonymous
Not applicable

Date formatting issue when loading data from CSV file

Hello Community,

I have uploaded below excel (csv) file into Qlik. I am trying to format Column [Received Date] as time stamp but it doesn't work as expected. If you see, it is working fine when the hour is a double digit, but failing when to convert it into time stamp when the hour is in single digit.

Can somebody help with it? Has anyone seen this before?


LOAD ID,

   [Received Date],

          Timestamp( Timestamp#( [Received Date],'MM/DD/YY hh:mm:ss TT'),'MM/DD/YY hh:mm:ss TT') as [New Received Date]

FROM

[..\..\.\*.csv]

(txt, codepage is 1252, embedded labels, delimiter is '|', msq);

Output File

IDReceived DateNew Received Date
102/29/16 12:54:47 PM02/29/16 12:54:47 PM
202/29/16 12:55:31 PM2/29/2016  12:55:31 PM
301/05/16  1:59:05 PM
401/05/16  2:46:13 PM
501/05/16  2:55:32 PM
601/05/16  3:06:20 PM
7

02/01/16 11:26:52 AM

02/01/16 11:26:52 AM
802/04/16 11:37:40 AM02/04/16 11:37:40 AM

Any help is appreciated.

1 Solution

Accepted Solutions
MarcoWedel

Hi,

you seem to have double spaces in your timestamps between date and time in those cases. So one solution might be:

QlikCommunity_Thread_209071_Pic1.JPG

LOAD ID,

    [Received Date],

    Timestamp#(Replace([Received Date],'  ',' '),'MM/DD/YY hh:mm:ss TT') as [New Received Date]

FROM QlikCommunity_Thread_209071.csv (txt, codepage is 1252, embedded labels, delimiter is '|', msq);

hope this helps

regards

Marco

View solution in original post

4 Replies
sunny_talwar

Try this:

Removed one h from hh:mm:ss TT

LOAD ID,

  [Received Date],

          Timestamp( Timestamp#( [Received Date],'MM/DD/YY h:mm:ss TT'),'MM/DD/YY hh:mm:ss TT') as [New Received Date]

FROM

[..\..\.\*.csv]

(txt, codepage is 1252, embedded labels, delimiter is '|', msq);

MarcoWedel

Hi,

you seem to have double spaces in your timestamps between date and time in those cases. So one solution might be:

QlikCommunity_Thread_209071_Pic1.JPG

LOAD ID,

    [Received Date],

    Timestamp#(Replace([Received Date],'  ',' '),'MM/DD/YY hh:mm:ss TT') as [New Received Date]

FROM QlikCommunity_Thread_209071.csv (txt, codepage is 1252, embedded labels, delimiter is '|', msq);

hope this helps

regards

Marco

Anonymous
Not applicable
Author

Thanks Marco, it worked perfectly..

MarcoWedel

you're welcome

regards

Marco