Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QV date time issue

Hi guys,

I have a question as follows. Original I have the date variable, how to get 4 months later for each record as the new variable date1?

I asked this question before, but the issue is that now the format of the date contains time. Anyone could help? Thanks!

Original table:

IDdatescore
12009-12-31 12:00:00 AM80
22011-06-30 12:00:00 AM50

Final table

IDdate1datescore
104/20102009-12-31 12:00:00 AM80
210/20112011-06-30 12:00:00 AM50
7 Replies
tresesco
MVP
MVP

Load

          Date(AddMonths(Date#(date,  'YYYY-MM-DD hh:mm:ss TT'),4), 'MM/YYYY') as date1

Not applicable
Author

Hi, I tried this but it still doesn't work...not sure why...

Not applicable
Author

Try this

 

TT:

Load *,Date(AddMonths(Date(SubField(date,' ',1)),4),'MM/YYYY') as Date1;
Load * Inline [
ID, date, score,
1, 2009-12-31 12:00:00 AM, 80
2, 2011-06-30 12:00:00 AM, 50
]
;

tresesco
MVP
MVP

It should work if your date field data format is similar. Else, try to share your sample app with sample data.

its_anandrjs

Convert new date field like

Date(AddMonths(Date#(date,'YYYY-MM-DD  hh:mm:ss TT'),4),'MM/YYYY') as newDate

See the sample example for this

LOAD  date,ID,score, Date(AddMonths(Date(Left(date,10)),4),'MM/YYYY') as NewDate;

LOAD * Inline

[

ID, date, score

1, 2009-12-31 12:00:00 AM, 80

2, 2011-06-30 12:00:00 AM, 50

];

Regards

its_anandrjs

If having problem then create a new field like this also

Date(AddMonths(Date(Left(date,10)),4),'MM/YYYY') as NewDate;

rustyfishbones
Master II
Master II

Like the others have said try

2014-04-10_1009.png