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

date() vs timestamp()

Dear All,

I have read so many document about date() and timestamp()

but did not get it why we required this 2 function independently.

The reason behind asking this question is we can perfom date and time formating with date() as well as timestamp() also.

So why 2 different function available???

Which one is most preferable??

Please share knowledge

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

dreamer4

You're right that both are doing the same thing. The following two calls return the same values:

    Date(Time,'YYYY-MM-DD hh:mm'),

    Timestamp(Time,'YYYY-MM-DD hh:mm'),

The only difference is in the defaults. The reason why it is the way it is, is mostly historical.

HIC

View solution in original post

14 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

True, they do not differ a lot, except that both functions default to different format strings if you omit the second parameter.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Sorry, forgot about the second part of your question. I do not have a preference except that typing date takes less time (! there you have the third sister-function) than typing timestamp

Best,

Peter

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

Full understanding of Date is important for QV developers. I will advice to read the following blogs from HIC

The Date Function

Get the Dates Right

Automatic Number Interpretation

PrashantSangle
Author

Like it

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
PrashantSangle
Author

Hi,

thanks for reply.

I have already read this article but did not get the reason why 2 independent function availble in qlikview even if both perform same thing????????

Thanks again.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
vvvvvvizard
Partner - Specialist
Partner - Specialist

when using the date function on a timestamp you may not always get the desired output in calculations , use the timestamp when the date has a time with it eg 01/09/2015 17:23:12 and date for just dates without time

PrashantSangle
Author

Hi,

I dont think so the formatting is happening beacuse of date() and timestamp()

It is happening because you setting format in in load script

check your

dateFormat

and TimestampFormat in script.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
PrashantSangle
Author

Hi,

AnyOne??

Sir hic and Sir mby

please comment on this.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
hic
Former Employee
Former Employee

dreamer4

You're right that both are doing the same thing. The following two calls return the same values:

    Date(Time,'YYYY-MM-DD hh:mm'),

    Timestamp(Time,'YYYY-MM-DD hh:mm'),

The only difference is in the defaults. The reason why it is the way it is, is mostly historical.

HIC