Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Converting date formats to numeric Date "YYYYMM"

Hi,

while writing a incremental load (to just load the last month), there were some problems with the date formats of qlikview functions and the database.

The Date for each set of data is stored in the database as YYYYMM or YYYYMMDD and YYYYMMDD hh:mm.

The Problem is, that the date functions like now(), today() or date() create values, that are sometimes stored differently than they are formatted in the output (f.e. in tables or textfields)


LET vMaxDate= date(today()-30,'YYYYMM');

output= 201507

stored data = 42290


when i tryed to limit a load based on a date, the $(vMaxDate) variable showed f.e. 201507, but internally, it was stored as 42290 and didnt match the "DATE" field in the database, which is formatted ('201507').


How can i convert the output of a date or time function, to show the date as an integer value ?

2 Replies
settu_periasamy
Master III
Master III

Hi,

May be try thies
LET vMaxDate= Text(date(today()-30,'YYYYMM'));

jagan
Luminary Alumni
Luminary Alumni

Hi,

It is working as expected, check below script

LET vMaxDate= date(today()-30,'YYYYMM');

LOAD

'$(vMaxDate)' AS MaxDate

AutoGenerate (1);

If not working use Text() to convert it to text.

Regards,

Jagan.