Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
raju_insights
Partner - Creator III
Partner - Creator III

How to add Year to a date field ?

Hi Techies,

I have a date field and it has only month / day. For example,

Date Field

6/30

7/1

7/2

7/3

7/4

7/5

How do I add year to make it

6/30/2015

7/1/2015

7/2/2015

7/3/2015

7/4/2015

7/5/2015

in order to link it to master calendar.

Note: These fields will be updated daily. So when the year reaches 2016, dynamically 2015 should be changed to 2016.

How do I  Achieve it ?

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Date(Date#([Date Field] & '/' & Year(Today()), 'MM/DD/YYYY'), 'MM/DD/YYYY') as [Date Field]

View solution in original post

5 Replies
sunny_talwar

May be this:

Date(Date#([Date Field] & '/' & Year(Today()), 'MM/DD/YYYY'), 'MM/DD/YYYY') as [Date Field]

raju_insights
Partner - Creator III
Partner - Creator III
Author

Awesome Sunny. Thanks.

raju_insights
Partner - Creator III
Partner - Creator III
Author

Hi Sunny, I have a doubt. We are using year(today()), suppose if year reaches 2016, all the entries in date field would have 2016 , right?

But I need like,

12/29/2015

12/30/2015

12/31/2015

1/1/2016

1/2/2016

1/3/2016

How to achieve this, Thanks...

sunny_talwar

Don't you have a year field in your database? Cause what you are asking is going to be very difficult, if not impossible

jagan
Luminary Alumni
Luminary Alumni

Yes, it will take the current year and all your dates changed to year 2016.

You can also try like this

MakeDate(Year(Today()), SubField(DateFieldName, '/', 1),  SubField(DateFieldName, '/', 2)) AS Date

Regards,

Jagan.