Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Chanty4u
Esteemed Contributor III

RE:Date format

hi all,

how to chnage the date formats while loading...

if i hve the data with diffrnt date formats?

thanks in advance''''

Suresh

1 Solution

Accepted Solutions
raajaswin
Contributor III

Re: RE:Date format

Check this file.. Hope it helps

12 Replies
MVP
MVP

Re: RE:Date format

Date(datefield, 'YourDesiredDateFormat') as NewDate

prieper
Honored Contributor II

Re: RE:Date format

Do you mean that you will have different dateformats in the source-data?

If yes, you may use the ALT-funtion:

quote from OL:

alt( date#( dat , 'YYYY/MM/DD' ),

date#( dat , 'MM/DD/YYYY' ),

date#( dat , 'MM/DD/YY' ),

'No valid date' )

unquote

HTH Peter

raajaswin
Contributor III

Re: RE:Date format

Date(<DateColumn>,'Format') as NewDate

Format may be like MMDD, DDMM, DDMMM, DDMMMYYYY, DD/MM/YYYY ..etc...

effinty2112
Honored Contributor

Re: RE:Date format

Hi,

Try this if the the date you want to change is currently a text field rather than a Date field with a dual representation:

Date(Date#('YourDateText','OldDateFormat'),'NewDateFormat')

Chanty4u
Esteemed Contributor III

Re: RE:Date format

chk attached sample excel

MVP
MVP

Re: RE:Date format

Hi,

Try like this using Date()

Syntax:

Date(DateFieldName, 'DateFormat')

Example:

Date(BillDate, 'DD-MMM-YYYY')

Date(BillDate, 'MM/DD/YYYY')

Date(BillDate, 'DD/MM/YYYY')  etc.


Hope this helps you.


Regards,

jagan.

Chanty4u
Esteemed Contributor III

Re: RE:Date format

plz chk sample qvw

MVP
MVP

Re: RE:Date format

Try like:

Date(

Alt(

     Date#(DateField, 'DD-MMM-YYYY') ,

          Date#(DateField, 'DD-YYYY-MMM'),

               Date#(DateField, 'MMM-DD-YYYY'),

                    Date#(DateField, 'MMM-YYYY-DD'),

                         Date#(DateField, 'YYYY-MMM-DD'),

                           Date#(DateField, 'YYYY-DD-MMM')

)

, 'YYYY-MMM-DD'

)

Edit: prieper‌ has already suggested similar. Corrected and included all posible date formats.

raajaswin
Contributor III

Re: RE:Date format

Check this file.. Hope it helps

Community Browser