Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How create a datetime varaible from a date varaible and hours variable ?

Hi everybody,

How create a datetime varaible from a date variable and a hour variable ?

many thanks !

FC

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If your date is an actual date (meaning a number and not a string) and your hours are numbers too then date + hours/24 will result in a datetime (aka timestamp). If not you can try timestamp#(date & ' ' & hour, 'DD/MM/YYYY hh'). Change 'DD/MM/YYYY hh' to whatever matches the date format of your date.

vDate:  41080

vHour: 18

vDateTime: =$(vDate)+$(vTime)/24

vDate: '25/03/2013'

vHour: 18

vDateTime: =timestamp#(vDate & ' ' & vHour,'DD/MM/YYYY hh')


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If your date is an actual date (meaning a number and not a string) and your hours are numbers too then date + hours/24 will result in a datetime (aka timestamp). If not you can try timestamp#(date & ' ' & hour, 'DD/MM/YYYY hh'). Change 'DD/MM/YYYY hh' to whatever matches the date format of your date.

vDate:  41080

vHour: 18

vDateTime: =$(vDate)+$(vTime)/24

vDate: '25/03/2013'

vHour: 18

vDateTime: =timestamp#(vDate & ' ' & vHour,'DD/MM/YYYY hh')


talk is cheap, supply exceeds demand
Not applicable
Author

Many thanks Gysbert !