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

Excel Timestamp column has multiple formats

Hi

I have an excel spreadsheet which unfortunately has the Timestamp column formatted in one of two formats : 02 Apr 2019 09:36 or 02/04/19 3:44:00 PM depending on which source is adding data to the spreadsheet.  

I thought I could use the alt function : Timestamp(alt(Timestamp#([DateTime],'DD MMM YY hh:mm'), Timestamp#([DateTime],'DD/MM/YYYY hh:mm')) ,'DD/MM/YYYY hh:mm') AS [DateTime]

but only the dates with the following format  02 Apr 2109 09:36 are transfromed to the correct format. 02/04/19 3:44:00 PM format is blank. Have tried all the combinations of hh:mm:ss TT. To transformed these dates I cannot use the timestamp# function just Timestamp([DateTime],'DD/MM/YYYY hh:mm') AS [DateTime]. 

Is there any way I can transform both formats in my load script without having to manually reformat the spreadsheet ?

Thanks

5 Replies
sunny_talwar

Try this may be

TimeStamp(
 Alt(
  Num(TimeStamp#([DateTime],'DD MMM YY hh:mm')),
  Num(TimeStamp#([DateTime],'DD/MM/YYYY hh:mm:ss TT'))
 )
, 'DD/MM/YYYY hh:mm') AS [DateTime]
dmoon2208
Contributor III
Contributor III
Author

Thanks but did not solve the problem. It seems to be a Qlik to xlsx format issue. If I export the spreadsheet as a csv, my original formula works

Vegar
MVP
MVP

Im not sure if it week have an impact, but notice that
02/04/19 3:44:00 PM
is not in the 'DD/MM/YYYY hh:mm TT' format but formatted as
'DD/MM/YYYY h:mm TT'.
Channa
Specialist III
Specialist III

Date( DateTime,'DD/MM/YYYY HH:mm:ss')

Channa
dmoon2208
Contributor III
Contributor III
Author

Thanks but none of the suggestion work when the file is an excel file. When I convert to csv most of the suggestions work. I have managed to get my source to change the format to a csv.