Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

igdrazil
Contributor III

Date from seconds to hour

Hi there, i have a date field that is like this: "DD.MM.YYYY - HH:mm:ss"

and it want to group my data to "DD.MM.YYYY - HH"

is it possible to do this in front end?

Regards

Chris

Tags (4)
1 Solution

Accepted Solutions
MVP
MVP

Re: Date from seconds to hour

Try:

=Timestamp#(Subfield(Field,':',1), 'DD-MM-YYY - hh')

You might have to adjust the spaces in the format.

5 Replies
MVP
MVP

Re: Date from seconds to hour

Timestamp(YourField, 'DD.MM.YYYY - HH')

igdrazil
Contributor III

Re: Date from seconds to hour

But then i will get lots of dates with hour 6 for example, but i need them to be grouped together so i will get 1 bar in barchart with all values for 30.11.2015 hour 6 and one bar for hour 7 and so on

MVP
MVP

Re: Date from seconds to hour

Try:

=Timestamp#(Subfield(Field,':',1), 'DD-MM-YYY - hh')

You might have to adjust the spaces in the format.

reddys310
Honored Contributor II

Re: Date from seconds to hour

Hi Christoph,

This is how you can achieve it:

let vtime = date(date#('10/11/2015 09:31:12','DD/MM/YYYY h:mm:ss'),'DD/MM/YYYY h:mm:ss');

let vYourFormat = date(vtime,'DD/MM/YYYY') & ' - ' & hour(timestamp(vtime));

These expressions can be made use of both in the front end and in the script as well. But for performance purposes make use of this in the script.

igdrazil
Contributor III

Re: Date from seconds to hour

Thanks for all your posts! I'll try both of them at the moment i did it like this:

Date(Datefield) & ' - ' & Hour(Datefield)

Regards

Chris

Community Browser