Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change the date values

Hi,

I have field a containing dates from Jan1st to Dec31st 1997,How to convert these

values into Jan1st to  Dec31st 2008,plese send the answer,thanks in advance

7 Replies
MayilVahanan

HI

Try like this

SetDateYear (DateField, '2008')

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks mahal,  but I have 1997,96,95. Year from Jan to Dec .  I have to change them into

2008,07,06     Jan to Dec...please reply

MayilVahanan

Hi

     Try like this,

Load *,if(Year(DateField) = 1997, SetDateYear (DateField, '2008'), if(Year(DateField)=1996,

SetDateYear (DateField, '2007'),SetDateYear (DateField, '2006'))) as ModifiedYear from tablename;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Hi rameshmca,

You can use a date function for this:

=AddYears(DateField, 11)

Let me know, if this changes if helpful for you.

Regards,

Ricardo

Not applicable
Author

Hi Ricardo,

   Thanks for your suggestion,its working ,  but I didnot understood what is meaning of 11 in the function, with the use of 11 how its changing years can you explain in detail.

Not applicable
Author

2008 - 1997 = 11 years of difference

AddYears( <Name of the date field>, <# of years you want to add> )

AddYears('01/01/1997', 11)  = '01/01/2008'

Thanks,

Ricardo

Not applicable
Author

It is very helpful

Thanks Recardo

Regard,

Ramesh