Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Date Format

Hi,

I have a date format as "Apr 2 2011 12:00 AM", how can I convert this into "YYYYMMDD"? The time is always12:00 AM.

Thanks.

4 Replies
MVP
MVP

Re: Date Format

= date(

date#('Apr 2 2011 12:00 AM', 'MMM DD YYYY hh:mm TT'), 'YYYYMMDD'

)

look at this for date and date# functions

QlikView Date fields

EDIT

see attachment

110652.png

vidyut
Contributor II

Re: Date Format

Makedate(Subfield(DateString,' ',3),Div(Index($(MonthNames),Subfield(DateString,' ',1)),4)+1,Subfield(DateString,' ',2)) as Date

Try this. $(MonthNames) refers to the variable MonthNames defined by default in your script.

Cheers,

Vidyut

Not applicable

Re: Date Format

You are close,

Can you please help identify the error in this code

(Subfield([Fiscal Week Ending Date],' ',3),Div(Index($(MonthNames),Subfield([Fiscal Week Ending Date],' ',1),4)+1,Subfield([Fiscal Week Ending Date],' ',2))) as Date

[Fiscal Week Ending Date], is my date variable and seems like ')' is missing.

Not applicable

Re: Date Format

I tried this. not working

Community Browser