Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Strange date format when exporting to CSV

Hello,

I am experiencing a strange issue.

I tried to load a QVD and export it to a CSV.  The first column in my QVD is a date field.  If I simply load all the columns

from the QVD and store into a CSV, the date field comes out as date (see below).  But as soon as I specify a WHERE clause

in the load script, the date column becomes a date serial (see below).  If I remove the WHERE clause and run it again, it stores

the date in the CSV.  Date format is what I want and not date serial.  I need to have a WHERE clause and have the date come out.

What do I need to do?  This is kind of strange.  I'm sure there is a reason.  Thanks for your help.

Without the WHERE clause

7/1/2011 12:00:00 AM

7/1/2011 12:00:00 AM

7/1/2011 12:00:00 AM

7/1/2011 12:00:00 AM

7/1/2011 12:00:00 AM

7/7/2011 12:00:00 AM

With the WHERE clause

40730

40730

40729

40729

40729

40729

14 Replies
sunny_talwar

May be wrap your date field around with a date function:

Date(DateField) as DateField

satishkurra
Specialist II
Specialist II

Apart from Sunny T response,

Also try Date(Date#(DateField),'YYYY-MM-DD') as DateField  to avoid further complications

Thanks

Satish

Anonymous
Not applicable
Author

Thanks.  It worked.  However it truncated the time portion of my date.  How do I format this so I will not lose the time?

Anonymous
Not applicable
Author

Satish,

I get blanks for this column when I used your solution.  Is there a formatting issue in your suggestion?

roger_stone
Creator III
Creator III

Actually I think that when you run this without a WHERE clause, QlikView is interpreting the field as text rather than date/time. Can you share the WHERE clause with us?

sunny_talwar

Try:

TimeStamp(DateField) as DateField

Anonymous
Not applicable
Author

The WHERE I included is not even on this date field.  It's on another field which is text.  I put in the WHERE so I

restrict the rows on the output.

Anonymous
Not applicable
Author

Sunny, this worked.  Thanks!!

roger_stone
Creator III
Creator III

OK, can you share the LOAD statement complete with WHERE clause so that we can get a better idea of what might be happening?