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

Date format

Hi I have dates like below format:

T.PNG

Now when write the following condition in script only for few dates are converting and for remaining it is not converting. Below image for reference.

code written in script date(MonthStart(Date#(Technical_Start_Date,'D/MM/YYYY')),'YYYY-MM') as Technical_Start_Date,

T.PNG

Can you please tell me if i am missing something.

Thanks,

Bharat

9 Replies
poojashribanger
Creator II
Creator II

try this

date(MonthStart(Date#(Technical_Start_Date,'DD/MM/YYYY')),'YYYY-MM')

Sergey_Shuklin
Specialist
Specialist

Hello!

You are using Date#(Technical_Start_Date,'D/MM/YYYY') for dates like 12/22/1993. Is everything right here?


poojashribanger
Creator II
Creator II

hey i think you are giving wrong format in date#

try tthis

date(MonthStart(Date#(Technical_Start_Date,'MM/DD/YYYY')),'YYYY-MM')

poojashribanger
Creator II
Creator II

You Can try this

date(MonthStart(date(Date#(Technical_Start_Date,'MM/DD/YYYY'))),'YYYY-MM')

shraddha_g
Partner - Master III
Partner - Master III

Try date(MonthStart(Date#(Technical_Start_Date,'M/D/YYYY')),'YYYY-MM')

dx_anupam
Creator
Creator

Hi Bharat,

Can you please confirm the type of  Technical_Start_Date is it date or string?

if it is date please try below formula

Date(MonthStart([Order Date],0),'YYYY-MM') as Order_month

Regrads,
Anupam

HirisH_V7
Master
Master

You can use Alt function and do like this ,

Data:

LOAD *,

Date(Alt(Date#(Date,'DD/MM/YYYY'),Date#(Date,'MM/DD/YYYY'),Date),'YYYY-MM') as Date_T2;


LOAD * INLINE [

    Date

    1/1/1950

    22/12/1993

    1/1/1950

    5/1/1987

    6/30/1993

    8/26/1993

    12/22/1993

    7/22/1985

    2/1/1996

];

Date.JPG

HTH,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Anonymous
Not applicable

Please use this function  Date(Date#(fieldname, 'DD-MM-YYYY'),'YYYY-MM')as new filed

johnca
Specialist
Specialist

Is the format of your date field always Month/Day/Year or ?

Assuming it is Month/Day/Year and not Day/Month/Year (as you seem to want to use) then...

Date(MonthStart(Date#(Technical_Start_Date,'M/D/YYYY')),'YYYY-MM') as Technical_Start_Date

...should work.

If it is a mix of both you're not going to get there as how is QlikView supposed to know the difference between 7/1/2018 and 1/7/2018?

Please supply a file of ALL the Technical_Start_Date from your QVD BEFORE they are transformed by your expression. To me, there is not enough clear data to evaluate here.

HTH,

John