Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

pavanqlik
New Contributor II

Issue with date format, i have date field with format 5/12/2015 as string and 20150205 as number need to convert it to MM/DD/YYYY format

Hi,

   I had a date field with some rows in excel

  1)  1-8 it shows as string M/DD/YYYY

  2)   9-10 it shows as text YYYYMMDD



Could you please help me in converting this into  'MM/DD/YYYY' format.



Thanks,

Pavan

2 Replies
Highlighted
qlikmsg4u
Valued Contributor

Re: Issue with date format, i have date field with format 5/12/2015 as string and 20150205 as number need to convert it to MM/DD/YYYY format

Try this

Load *,Date(Alt(Date#(Date,'MM/DD/YYYY'),Date#(Date,'YYYYMMDD')),'MM/DD/YYYY') as Date1;

LOAD * INLINE [

    Date

    01/01/2016

    01/02/2016

    01/03/2016

    01/04/2016

    01/05/2016

    20160106

    20160107

    20160108

    20160109

    20160110

];

Not applicable

Re: Issue with date format, i have date field with format 5/12/2015 as string and 20150205 as number need to convert it to MM/DD/YYYY format

Try this

In load script,

Date(Alt(Date#(datefield,'M/DD/YYYY'),Date#(datefield,'YYYYMMDD'),'MM/DD/YYYY' ))  As newdate

Hope this helps.