Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

gshockxcc
Contributor

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

Re: Problem separating Date and Time

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

4 Replies
datanibbler
Esteemed Contributor

Re: Problem separating Date and Time

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

Re: Problem separating Date and Time

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

MVP
MVP

Re: Problem separating Date and Time

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

gshockxcc
Contributor

Re: Problem separating Date and Time

Ruben,

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

Community Browser