Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

There is possible to Set as Vdate='1900-01-01' in QlikView?

Hi Guys,

When I am trying to Set a variable to a date value '1900-01-01', I am getting output as '1905-03-12'. I am getting getting why it is evaluating like this. Please see the below sample script.

SET DateFormat='YYYY-MM-DD';

SET vDate='1900-01-01';

SET vTwoYearsOldDate=DATE($(vDate));

LET vTwoYearsOldDateKey=DATE($(vTwoYearsOldDate),'YYYYMMDD');

SET vTwoYearsOldYearMonth=YEAR($(vTwoYearsOldDate))&'_'&MONTH($(vTwoYearsOldDate));

TABLE_2:

LOAD

$(vTwoYearsOldDate) AS TwoYearsOldDate,

$(vTwoYearsOldDateKey) AS TwoYearsOldDateKey,

$(vTwoYearsOldYearMonth) AS TwoYearsOldYearMonth

AUTOGENERATE(1);

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Your script is not properly interpreting 1900-01-01. It is doing 1900 minus 1 minus 1 which is where you get the 1905 date.

Change the second line to:

LET vDate=num(date#('1900-01-01', 'YYYY-MM-DD'));

-Rob

http://masterssummit.com

http://robwunderlich.com

View solution in original post

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Your script is not properly interpreting 1900-01-01. It is doing 1900 minus 1 minus 1 which is where you get the 1905 date.

Change the second line to:

LET vDate=num(date#('1900-01-01', 'YYYY-MM-DD'));

-Rob

http://masterssummit.com

http://robwunderlich.com