Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Ok i have a lot of dates from different tables loaded from SQL into QVD (they need to stay the default like in the SQL table for other reports).
Example from dates i currently have
Now i want them all to be like the first Example (40099) and they need to be Truncated like in sql (The hours, minutes and seconds need to be gone forever). But Qlikview has no Truncate function.
How can i convert 1, 2 and 3 to 1 with no (hidden)hours, minutes and seconds annymore?
Thanks a lot!
Dates and timestamps are internally stored as numbers, so it is just a matter of truncating the number to an integer. Then you will have what you want.
You can load your examples using the following formulae
And if you have a mixture, you can use the following:
Floor(Alt(
Date#(x,'DD/MM/YYYY hh:mm:ss'),
Date#(x,'DD/MM/YYYY'),
Num#(x,'#',',','.')
))
Yes, you can use string functions, but in my experience you get other problems then: You sometimes lose the dual/numeric property; you have no test that the date has been correctly interpreted, etc. So I always avoid string functions for date/time fields.
HIC
The Floor() function does exactly this.
HIC
Can you explain me exactly how?
I also found out that the left(Date, 5) as Date can help a lot.
Dates and timestamps are internally stored as numbers, so it is just a matter of truncating the number to an integer. Then you will have what you want.
You can load your examples using the following formulae
And if you have a mixture, you can use the following:
Floor(Alt(
Date#(x,'DD/MM/YYYY hh:mm:ss'),
Date#(x,'DD/MM/YYYY'),
Num#(x,'#',',','.')
))
Yes, you can use string functions, but in my experience you get other problems then: You sometimes lose the dual/numeric property; you have no test that the date has been correctly interpreted, etc. So I always avoid string functions for date/time fields.
HIC