Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

date format

Hi there,

I need to create a report and the date field retrieved via my sql DB which is string...I need to convert it date format on qlikview..

My date field is : YYYY-MM-DD h:mm:ss

how can I convert it on qlikview on edit script section?

Thanks for give me a hand!

9 Replies
Not applicable
Author

Hi,

You can use Date#() function.

Example: Date#(Yourfield,'YYYY-MM-DD h:mm:ss')

This would interpret the string as date.

Thanks

AJ

DavidFoster1
Specialist
Specialist

In your database, is the field held as a date or text field

Not applicable
Author

Attached is an example.

Thanks

AJ

rustyfishbones
Master II
Master II

Hi,

You can try

2014-02-26_1643.png

Not applicable
Author

You would use the date#() function to tell Qlikview how to interpret the string, and if you want to change the format you would nest it inside of a date() funcion for example:

date(Date#(Yourfield,'YYYY-MM-DD h:mm:ss'), 'MM-DD-YYYY h:mm:ss')

Not applicable
Author

Hi David,

The date field held as a text..

PrashantSangle

hi,

You can use

date(date#(yourDatefield,'YYYY-MM-DD'),'YYYY-MM-DD')

and timestamp(timestamp#(yourDatefield,'h:mm:ss')'h:mm:ss')

if your date field in string in your database.

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 🙂
Not applicable
Author

Hi Ajay,

I have tried it but I have got only one date and I havent seen different dates...I checked DB side and have seen all data...when I retrived data on qlikview I got only current date...what is the wrong for me?

Not applicable
Author

Can you attach your script please if possible. You can may be do a preload like:

Load

Date#(DateField,'YYYY-MM-DD h:mm:ss') as DateField,

Dim1,

Dim2  ;

SQL Select

DateField,

Dim1,

Dim2

From DataBase;