Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
n1ef5ng1
Creator
Creator

combine date and hour field?

I made a mistake at the start, i hope there is a way i can combine on script and not reload all the data again.

     Date(floor(Alt(Date,timestamp#(Date,'MM-DD-YYYY hh:mm:ss'))),'DD/MM/YYYY') as Date,

      hour(Alt(Date,Timestamp#(Date,'MM-DD-YYYY hh:mm:ss'))) as Hour,

I have these fields all ready, Date and Hour... i miss the important part which is combining date and hour. (stupid me).

Is there any way i can salvage this by on the loading script, to combine Date and Hour that i have pre-calculated into 01-11-2016 06

i.e DD-MM-YYYY hh

the reason why i diden want to recalculate because each month has a differne ttime stamp format, i dun wan to go through that hassle again for 5 years of data ;(

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Sunny T <span class="icon-status-icon icon-mvp" title="Mvp"></span> wrote:

If Date and Hour are already interpreted as Date and Hour by QlikView, then why not just this

TimeStamp(Date + Hour) as Testing

I guess you want to use something like

Timestamp(Date + Hour / 24) as Testing

if Hour is already in range 0 to 23, like returned from Hour() function.

Or formatted as requested:

Timestamp(Date + Hour / 24, 'DD/MM/YYYY hh') as Testing


Date and Hour need to be fields in your input table, you may want to use a preceding load if both fields are just created in the same LOAD statement you want to modify.

Preceding Load

Get the Dates Right

Why don’t my dates work?

View solution in original post

5 Replies
n1ef5ng1
Creator
Creator
Author

(Timestamp#(Date + Hour, 'DD/MM/YYYY hh')) as Testing,

this may work. but is now in strange 5 digit code

42671

42672

simondachstr
Luminary Alumni
Luminary Alumni

You need to format that number back TimeStamp((Timestamp#(Date + Hour, 'DD/MM/YYYY hh')) ,'DD/MM/YYYY hh')

sunny_talwar

If Date and Hour are already interpreted as Date and Hour by QlikView, then why not just this

TimeStamp(Date + Hour) as Testing

annafuksa1
Creator III
Creator III

you can use preceding load and formula Date&' '&Hour

Anna

swuehl
MVP
MVP

Sunny T <span class="icon-status-icon icon-mvp" title="Mvp"></span> wrote:

If Date and Hour are already interpreted as Date and Hour by QlikView, then why not just this

TimeStamp(Date + Hour) as Testing

I guess you want to use something like

Timestamp(Date + Hour / 24) as Testing

if Hour is already in range 0 to 23, like returned from Hour() function.

Or formatted as requested:

Timestamp(Date + Hour / 24, 'DD/MM/YYYY hh') as Testing


Date and Hour need to be fields in your input table, you may want to use a preceding load if both fields are just created in the same LOAD statement you want to modify.

Preceding Load

Get the Dates Right

Why don’t my dates work?