Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue with date formats

Hi,

I have the following code to generate dates:

Date:
LOAD
today()-recno()+1 as Date
autogenerate(today()-'2011-01-01');

DateParts:

LOAD
Date as Date,
Year(Date) as Year,
Month(Date) as Month,

MonthName(Date) as monthYear
RESIDENT Date;

Drop table Date;

However the dates I'm pulling in from my db to the QV script comes in the following format 'DD/MM/YYYY'

This is causing a conflict in my data, and my Month and Year listboxes are not linking with this date from my db.

I've tried to change the date format with the following code:

date#(date(date,'YYYY-MM-DD')) as event_date

Is there anything else I can do?

Thanks

Labels (1)
5 Replies
Anonymous
Not applicable
Author

Try this Date() or Date#() functions.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi - try this for the first load:

Date:

LOAD

          Date(today()-recno()+1, 'YYYY-MM-D') as Date

Autogenerate(today()-Date#('2011-01-01', 'YYYY-MM-DD');

Is YYYY-MM-DD the default date format on your system?

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

The date format I'm pulling into QV from my system is 'DD/MM/YYYY'

Thanks

nilesh_gangurde
Partner - Specialist
Partner - Specialist

At load time write the script as follows:

load *,

       DateField,

       num(DateField) as DateField_NUM,

       Date(DateField,'YYYY-MM-DD') as NewDateField;

Select * from TableName;

or anyways the formate of date will not affect the linking because it depends on the julien date.

Regards,

Nilesh Gangurde

Not applicable
Author

I used this, thanks for the help...

Date:

LOAD

Date(today()-recno()+1, 'DD/MM/YYYY') as Date

Autogenerate(today()-Date#('10/04/2012', 'DD/MM/YYYY'));