Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
nigel987
Creator II
Creator II

Date format changes when using where clasue on non-date field

Hi there,

I have a weird issue with my dates and cannot find the cause.

I load data from a qvd file in the following way:

Directory;

LOAD AdID,

     AdType,

     AdStatus,

     AdStartDate,

     AdEndDate

FROM

[..\QVD\Anzeigen.qvd]

(qvd);

In this case everything is fine. My dates are displayed in the following way: DD.MM.YYYY HH:MM:SS

But when I load the data together with a where clause on a field which is not a date field, the date fields are displayed as days sind Dec 1899.

Directory;

LOAD AdID,

     AdType,

     AdStatus,

     AdStartDate,

     AdEndDate

FROM

[..\QVD\Anzeigen.qvd]

(qvd)

WHERE AdStatus >= 50;

Does anyone know why this happens?

Appreciate any advise. Have a good day!

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Directory;

LOAD AdID,

     AdType,

     AdStatus,

     TimeStamp(AdStartDate) as AdStartDate,

     TimeStamp(AdEndDate) as AdEndDate

FROM

[..\QVD\Anzeigen.qvd]

(qvd)

WHERE AdStatus >= 50;

View solution in original post

8 Replies
MK_QSL
MVP
MVP

Directory;

LOAD AdID,

     AdType,

     AdStatus,

     TimeStamp(AdStartDate) as AdStartDate,

     TimeStamp(AdEndDate) as AdEndDate

FROM

[..\QVD\Anzeigen.qvd]

(qvd)

WHERE AdStatus >= 50;

tresesco
MVP
MVP

Perhaps, somehow it's being treated as string and then trying to convert to date. Try like:

LOAD AdID,

     AdType,

     AdStatus,

    Date(TimeStamp#(AdStartDate, 'DD.MM.YYYY HH:MM:SS')) as AdStartDate,

     Date(TimeStamp#(AdEndDate, 'DD.MM.YYYY HH:MM:SS')) as AdEndDate

FROM

[..\QVD\Anzeigen.qvd]

(qvd)

WHERE AdStatus >= 50;

nigel987
Creator II
Creator II
Author

Thank you Manish for the fast response! But do you know the reason why this happens?

MK_QSL
MVP
MVP

No idea but could be as per what tresesco has replied...!

nigel987
Creator II
Creator II
Author

Hi,

Manish's answer was already helpful, but I tried yours as well.

After I reload it, there seem to be no values in this field.

Directory;

LOAD AdID,

     AdType,

     AdStatus,

     Date(Timestamp#(AdCreated,'DD.MM.YYYY HH:MM:SS')) AS AdCreated,

     AdCreatedD

FROM

[..\QVD\Anzeigen.qvd]

(qvd)

WHERE AdStatus >= 50;

tresesco
MVP
MVP

Try making the second MM small, like

Date(Timestamp#(AdCreated,'DD.MM.YYYY HH:mm:SS')) AS AdCreated,

MK_QSL
MVP
MVP

Try

Date(Timestamp#(AdCreated,'DD.MM.YYYY hh:mm:ss')) as AdCreated

nigel987
Creator II
Creator II
Author

Hi,

I already have what I want by using

TimeStamp(AdCreated) as AdCreated,


but nevertheless, if you are interested:

neither

Date(Timestamp#(AdCreated,'DD.MM.YYYY HH:mm:SS')) AS AdCreated

nor

Date(Timestamp#(AdCreated,'DD.MM.YYYY hh:mm:ss')) AS AdCreated

did work for me.

Thanks