Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Makedate function returning strange dates...

Hello

I am working on an excel sheet with different columns for a date , ie Year, month, day.

LOAD Year,
Month,
Day,
Hour,
Celsius,
Rain_mm,
Sun_Minutes,
MakeDate (Day&Month&Year) as Date

i have been trying using MAKEDATE to generate the date but in returns...i have this...01.01.112012, 01.01.122012, etc...

what i have done wrong ?

thanks

JP

1 Solution

Accepted Solutions
Not applicable
Author

As already suggested, I'd use Date(MakeDate(Year, Month,Day),'DD.MM.YYYY')  AS Date.

View solution in original post

27 Replies
swuehl
MVP
MVP

MakeDate (Year, Month, Day) as Date

PrashantSangle

Hi,

go to help menu check the syntax of MakeDate()

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

thanks but now it is returning  01.01.2012...that it....;) any idea why ?

manojkulkarni
Partner - Specialist II
Partner - Specialist II

MakeDate(YYYY [ , MM [ , DD ] ] )

Returns a date calculated from the year YYYY, the month MM and the day DD.

If no month is stated, 1(January) is assumed.

If no day is stated, 1 (the 1:st) is assumed.

makedate(1999,2,14) returns 1999-02-14

Not applicable
Author

Thanks max dreamer, i have started with this point

MakeDate(YYYY [ , MM [ , DD ] ] )

Returns a date calculated from the year YYYY, the month MM and the day DD.

If no month is stated, 1(January) is assumed.

If no day is stated, 1 (the 1:st) is assumed.

Examples:

makedate(1999) returns 1999-01-01

makedate(99) returns 0099-01-01

makedate(1992,12) returns 1992-12-01

makedate(1999,2,14) returns 1999-02-14

but this is not 100% clear...and working

best

swuehl
MVP
MVP

Could you post some sample records of your data? Year, Month, Day must have a numeric representation, i.e. Month is not just a text value like 'Jan'. But from what you've posted above, I would expect some dates returned like 01.01.2012.

Or are you asking about the format? You can change the format using the script variables, or Date() formatting function:

Date(MakeDate (Year, Month, Day),'YYYY-MM-DD') as Date

swuehl
MVP
MVP

 

but this is not 100% clear...and working

best

What's unclear? What is not working? You need to tell us the problems to help you.

sasiparupudi1
Master III
Master III

what is the date format set in your script?

if you need it in a different format, use the date function to change the format

Date(MakeDate(Year, Month,Day),'YYYY-MM-DD')  AS Date

PrashantSangle

Hi,

try below,

LOAD *,MakeDate(Year,Month,if(isnull(Day) or len(trim(Day))<1 ,'1',Day)) as makeDate INLINE [

    Year, Month, Day

    2015, 3, 1

    2014, 2

    2015, 3, 15

];

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂