Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
sunil1989
Contributor
Contributor

convert integer column into date

Thanks in advance

Hi ,

i am new to qlik.

having column name DAY_KEY in integer format (20161227) want to convert in date format.

can anyone suggest solution.

9 Replies
datagrrl
Creator III
Creator III

=date(date#(DateField,'yyyymmdd'),'yyyy-mm-dd')

MarcoWedel

Hi,

you could try with

Date(Date#(DAY_KEY,'YYYYMMDD'))

to convert into your default DateFormat, or

Date(Date#(DAY_KEY,'YYYYMMDD'), 'MM/DD/YYYY')


to get another format as required.


Pay attention to use upper case MM instead of mm in this case as the latter means minutes instead of months. Although looking the same, the result might be wrong (different underlying numerical values).


QlikCommunity_Thread_251033_Pic1.JPG


hope this helps


regards


Marco

ramasaisaksoft

Hi,

Date#() will convert your integer format to Date format.

Ex:-

The Date# function formats any given string which holds a date to a valid date format

e.g. Date#('2015-08-18','YYYY-MM-DD')

The Date() formats a valid date field to your liking

date('2015-08-18','MM/YY') will Show 08/15

if you got the solution for your issue,please close the thread by clicking "Correct Answer"

priyasawant
Creator II
Creator II

The examples below assume the two following operating system settings:

    

Default setting 1

Default setting 2

Date format

  YY-MM-DD

  M/D/YY

date( A ) where A=35648 returns:

    

Setting 1

Setting 2

String

  97-08-06

  8/6/97

Number

  35648

  35648

date( A, 'YY.MM.DD' ) where A=35648 returns:

    

Setting 1

Setting 2

String

  97-08-06

  97-08-06

Number

  35648

  35648

date( A, 'DD.MM.YY' ) where A=35648.375 returns:

    

Setting 1

Setting 2

String

  06.08.1997

  06.08.1997

Number

  35648.375

  35648.375

date( A, 'YY.MM.DD' ) where A=8/6/97 returns:

    

Setting 1

Setting 2

String

NULL(nothing)

  97.08.06

Number

NULL

  35648

surendraj
Specialist
Specialist

date(date#(DateField,'yyyymmdd'),'MM-DD-YYYY')

Date is formatting function.

Date#() is used how to interpret the data.

By this function we need to tell to qlikview how your date format is...('yyyymmdd')

By Date function we convert this .'yyyymmdd' into 'MM-DD-YYYY'

so result will be 12-27-2017(dec 12th 2017)

muthukumar77
Partner - Creator III
Partner - Creator III

Hi,

try this,

=Date(MakeDate(Mid('20161227',1,4),Mid('20161227',5,2),Mid('20161227',8,2)),'DD-MMM-YYYY')

Muthukumar Pandiyan
MarcoWedel

please close your thread if your question is answered

Qlik Community Tip: Marking Replies as Correct or Helpful

thanks

regards

Marco

everest226
Creator III
Creator III

date(Date#(DAY_KEY,'YYYYMMDD'), 'MM/DD/YYYY')

sumitjadhav
Creator II
Creator II

Try this Expreesion inn your script:

Date(DAY_KEY,'DD-MM-YYYY') as Datekey