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

Month Format

I load date from sql, which originally is Datetime, and I only need data for QlikView.

Here is my set:

SET DateFormat='YYYY-MM-DD';
SET TimestampFormat='YYYY-MM-DD h:mm:ss[.fff] TT';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

And here is the different scripts I am trying to make the date format as I want:

DATE(MakeDate(year([Eff Dt]),month([Eff Dt]),day([Eff Dt])),'YYYY-MM-DD') as IssDate

DATE(DATE#([ISSUE DATE],'MM/DD/YYYY'),'YYYY-MM-DD') as IssDate,

Eff Dt is datetime originally, and Issue Date dateformat is as showed.

I want month to be 01,02,03 ...

I keep getting Jan, Feb, Mar ...

How can I fix it?

4 Replies
sunny_talwar

Try this:

Date(MakeDate(Year([Eff Dt]), Num(Month([Eff Dt])), Day([Eff Dt])), 'YYYY-MM-DD') as IssDate,

Not applicable
Author

Then, the problem is I want 01, 02, 03... insteand of 1,2,3...

swuehl
MVP
MVP

Try

LOAD

     IssDate,

    Num(Month(IssDate),'00') as MonthNum;

LOAD

     ... // Your Current Script that loads data from your DB

sunny_talwar

Stefan has provided the solution underneath

Num(Month([Eff Dt]), '00')