Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to get the date field from mm/dd/yyyy hh:mm:ss PM

can anyone help me on this....................

1 Solution

Accepted Solutions
stevelord
Specialist
Specialist

Try:

Date(Floor(Fieldname)) as Fieldname

Floor() drops everything after the decimal, which in the case of the Date 'number' is the hours, minutes, and seconds portion.

Floor()ing might cause issues though, if a given record happens more than once in the same day.  If this issue might exist, you should be able to let the timestamp through as is, then use the Number tab of the object to show the number as a particular kind of date.

View solution in original post

8 Replies
swuehl
MVP
MVP

To parse a text field with that format as timestamp:

Timestamp#(TEXTFIELD, 'MM/DD/YYYY hh:mm:ss TT')

to create a Date from that:

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

Not applicable
Author

it is not working

swuehl
MVP
MVP

Works for me:

=Date(daystart(Timestamp#('06/24/2013 08:09:23 PM', 'MM/DD/YYYY hh:mm:ss TT')),'MM/DD/YYYY')

So either your format is different or maybe you need to check for typos.

BTW: 'it is not working' is not a very useful comment

Not applicable
Author

As it is i tried but unable to get it

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

can you please check it

swuehl
MVP
MVP

Concatdate is a field name, right?

Then use it without the single quotes as shown in my first example.

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

Not applicable
Author

I tried it but it still not showing up

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

Anonymous
Not applicable
Author

please provide a sample file with that date field

stevelord
Specialist
Specialist

Try:

Date(Floor(Fieldname)) as Fieldname

Floor() drops everything after the decimal, which in the case of the Date 'number' is the hours, minutes, and seconds portion.

Floor()ing might cause issues though, if a given record happens more than once in the same day.  If this issue might exist, you should be able to let the timestamp through as is, then use the Number tab of the object to show the number as a particular kind of date.