Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Problem separating Date and Time

I found several other posts regarding the separation of date and time from a single field.  I implemented a method that appears to work, but only captures a few dates from all the available data. 

Any help would be appreciated.

Please see attached file.  Thanks.

1 Solution

Accepted Solutions
Highlighted

Hi Kristan, in subfield funtion you have to use [Date Time] instead of DateTime.

View solution in original post

4 Replies
Highlighted
Champion
Champion

Hi Kristan,

your DateTime field seems to be a Timestamp?

That is saved internally as a numeric value (decimal value). So you can use the Floor() and Frac() functions to split it - Floor() will get the day and Frac() will get the time out of that.

Then you can use the DATE() or TIME() functions to format it and, for instance, have only the hours (out of the time) displayed.

HTH

Best regards,

DataNibbler

Highlighted

Hi Kristan, in subfield funtion you have to use [Date Time] instead of DateTime.

View solution in original post

Highlighted
MVP
MVP

Try like:

Load

          Date(TimeStamp#(DateTime, 'MM/DD/YYYY hh:mm:ss')) as Date,

          Hour(TimeStamp#(DateTime, 'MM/DD/YYYY hh:mm:ss')) as Hour,

          Minute(TimeStamp#(DateTime, 'MM/DD/YYYY hh:mm:ss')) as Minute,

          Second(TimeStamp#(DateTime, 'MM/DD/YYYY hh:mm:ss')) as Second

Highlighted
Creator
Creator

Ruben,

     Perfect.  That small change, and it worked like a charm.  Exactly what I needed.  Thank you.