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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Hour

Hi,

I have date format like this " 23-03-2016 18:20:20". My requirement is to show in hours. How to show in Hour format?

Thanks

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

If you want this in script try like this

LOAD

*,

TimeStamp(TimeStamp#(Left(TimeFieldName, 13), 'DD-MM-YYYY hh')) AS Date_Hour

FROM DataSource;

Regards,

Jagan.

View solution in original post

7 Replies
Chanty4u
MVP
MVP

=Hour(ur field)

Chanty4u
MVP
MVP

or else u want with date also

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

Chanty4u
MVP
MVP

try this

=Time(Frac(Datefield, 'hh')

tamilarasu
Champion
Champion

Hi,

Try,

=Hour(Date#('23-03-2016 18:20:20','DD-MM-YYYY hh:mm:ss'))

Load *,

Hour(Date#(FieldName,'DD-MM-YYYY hh:mm:ss')) & ' Hours' as Hour

From Source

Not applicable
Author

Hi Jack,

Your requirement is not clear.

If you want to take hours out of your date field then you can use : hour(DateField)

If you want hours between today and your date field then you can use Interval function like:

=Interval(Date(Today(),'DD-MM-YYYY hh:mm:ss') - Date(Date#(DateField,'DD-MM-YYYY hh:mm:ss'),'DD-MM-YYYY hh:mm:ss'),'hh')

Please see : Today with timestamp will return : 31-03-2016 00:00:00

If you want exact time of now, you can use now() instead of Today()

Regards,

Anjali Gupta

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

TimeStamp(TimeStamp#(Left('23-03-2016 18:20:20', 13), 'DD-MM-YYYY hh'))

Regards,

Jagan.

jagan
Partner - Champion III
Partner - Champion III

Hi,

If you want this in script try like this

LOAD

*,

TimeStamp(TimeStamp#(Left(TimeFieldName, 13), 'DD-MM-YYYY hh')) AS Date_Hour

FROM DataSource;

Regards,

Jagan.