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

Date Function

What is the difference between the date and date# functions and the timestamp and timestamp# functions?

I want to display just the year of a given date. How would I do that if I'm receiving data that looks like 05-25-2010 10:05? I am using the following expression but it doesn't work : Year(Date(Timestamp#([Last Updated],'MM/DD/YYYY hh:mm')))

Thank you

2 Replies
Not applicable
Author

Date takes a number, Date# takes a string (I assume it is the same for Timestamp). Timestamp and Date both give you datetime type values. In your expression, you need to get rid of the Date function as Timestamp is already (kind of) a date.

Year(Timestamp#([Last Updated],'MM/DD/YYYY hh:mm'))


What format is Last Updated in? According to the format example given, you would want:

Year(Timestamp#([Last Updated],'MM-DD-YYYY hh:mm'))


Not applicable
Author

it is not quite true. You can use date('1/1/2001') and date#(39862). The difference is that date function returns a dual value with string and number implementation of the date. And # function tries to interpret the input parameter as a date and return a string or a number according to input parameter.