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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

Date Formating

Hi all,

I'm trying to format a date and having issues.  I need it in a MM/DD/YY format and it keeps putting it in a MM/DD/YYYY format.  My input is MM/DD/YY.  Here's my statement:

If([Years Serv] = 0,
Date(Date#(AddMonths([Hire Date],1,'MM/DD/YYYY'),'MM/DD/YY'))) as Days_30,

Labels (2)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

How about this

Date(If([Years Serv] = 0, AddMonths(Date#([Hire Date], 'MM/DD/YYYY'), 1)),'MM/DD/YY') as Days_30

or just this

Date(If([Years Serv] = 0, AddMonths([Hire Date], 1)), 'MM/DD/YY') as Days_30

 

View solution in original post

4 Replies
StarinieriG
Partner - Specialist
Partner - Specialist

Hi,

try this expression

If([Years Serv] = 0,

Date(AddMonths(Date#([Hire Date],'MM/DD/YYYY),1),'MM/DD/YY')) as Days_30,

tmumaw
Specialist II
Specialist II
Author

Any idea on bracket alignment....

sunny_talwar
MVP
MVP

How about this

Date(If([Years Serv] = 0, AddMonths(Date#([Hire Date], 'MM/DD/YYYY'), 1)),'MM/DD/YY') as Days_30

or just this

Date(If([Years Serv] = 0, AddMonths([Hire Date], 1)), 'MM/DD/YY') as Days_30

 

tmumaw
Specialist II
Specialist II
Author

Thanks Sunny the first one worked great.