Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

Case 926 Recode Date with time stamp into date format

Hi All

My Raw data as below :-

SeriesNameDocDate
SME7/2/2019  12:00:00AM
SME7/2/2019  12:00:00AM
SME7/2/2019  12:00:00AM
SFA7/2/2019  12:00:00AM
SME7/2/2019  12:00:00AM
SME12/19/2019  12:00:00AM

 

My Load script :-

Directory;
LOAD Series,
DocDate,
Date(Date#([DocDate],'M/D/YYYY'), 'DD/MM/YYYY') as [date]
FROM
QUOT_SD_.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

Can some one advise me where go wrong on the above script  mark in RED Color ? Now it return null.

Paul 

1 Solution

Accepted Solutions
Kushal_Chawda

@paulyeo11  is there is no space between hh:mm:ss (no space)AM? i.e hh:mm:ssAM ? if so try below

Date(floor(timestamp#([DocDate],'MM/DD/YYYY hh:mm:ssTT') ), 'DD/MM/YYYY') as [date]

or

Date(floor(timestamp#([DocDate],'MM/DD/YYYY hh:mm:ss TT') ), 'DD/MM/YYYY') as [date]

View solution in original post

5 Replies
Vegar
MVP
MVP

You where looking at a timestamp not a date. Try this. 

Date(floor(timestamp#([DocDate],'M/D/YYYY hh:mm:ss TT') ), 'DD/MM/YYYY') as [date]

paulyeo11
Master
Master
Author

Hi Vegar

I am still getting nill

Paul

paulyeo11
Master
Master
Author

Hi All

Can some one share with me where go wrong on below script :-

Date(floor(timestamp#([DocDate],'M/D/YYYY hh:mm:ss TT') ), 'DD/MM/YYYY') as [date]

Paul

Taoufiq_Zarra

@paulyeo11 

you can always do :

Makedate(left(subfield(DocDate,'/',3),4),subfield(DocDate,'/',1),subfield(DocDate,'/',2)) as [date]
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Kushal_Chawda

@paulyeo11  is there is no space between hh:mm:ss (no space)AM? i.e hh:mm:ssAM ? if so try below

Date(floor(timestamp#([DocDate],'MM/DD/YYYY hh:mm:ssTT') ), 'DD/MM/YYYY') as [date]

or

Date(floor(timestamp#([DocDate],'MM/DD/YYYY hh:mm:ss TT') ), 'DD/MM/YYYY') as [date]