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

Converting a timestamp to a date

Hi,

I didn't find out in the post a solution of this issue.

I have a file with a date in timestamp in seconds.

I'd like to display the date in format 'YYYY-MM-DD'.

How ?

Thanks for any help

JJJ

13 Replies
Not applicable
Author

Hi,

I had the same problem. This worked for me:

LOAD ........... date(ceil ( DateField)) AS DateField;


May be, you need a format string.

Regards, Roland

boorgura
Specialist
Specialist

JJJ,

These 4 functions should help achieving any conversion:

timestamp#(), timestamp(), date#(), date().

Of course, they will be driven by the Format string codes.

Hope it helps.

hector
Specialist
Specialist

Hi, a better solution for this issue is the function dayname()

Ex

Load
now() as TimeStamp,
dayname(now()) as Day
autogenerate(1);

Rgds

yblake
Partner - Creator II
Partner - Creator II

Hello Jean Jacques,

To convert Unix Timestamp to QlikView dates, use the following :

timestamp(<UnixTimeStamp>/ 86400 + 25569) as TS,
date(floor(<UnixTimeStamp>/ 86400 + 25569)) as Date,
time(frac(<UnixTimeStamp>/ 86400 + 25569)) as Time,

Yves.

Not applicable
Author

Thanks Guys for your effort

Yves'solution is the only working.

JJJ

hector
Specialist
Specialist

Hi, i've uploaded this example long time ago, did you check it?

http://community.qlik.com/media/p/109527.aspx

Rgds

Not applicable
Author

Thanks Hector, I didn't seen before.

Very nice example to understand the conversion of unix date.

regards

JJJ

djallelsadki
Partner - Creator
Partner - Creator

it's working thanks

alexmosq
Partner - Contributor III
Partner - Contributor III

Exactly what I was looking for. Thanks!