Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

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

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

1 Reply

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

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

Community Browser