Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problems while converting date format

Hi,

could somebody pls take a look into the following qvw and Excel file and tell me, why QV does not interpret the date format in the right way?!

I tried so many possibilities in the script - nothing worked...

background: I need to convert the field 'Dateformat' into the format of DateMonth and DateYear (MM/YYYY) for my mastercalendar.

Thanks,

Dave

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I would approach it like this. [The Interaction Created Timestamp] is being correctly interpreted. You'll need to floor() that field to get just the date portion. Then you can use a preceding load to create additional fields from the Date.

Tickets:

LOAD

          *,

          Date(MonthStart(Date),'MMM-YYYY') as MonthYear,

            Month(Date) as DateMonth,

           Year(Date) as DateYear

;

LOAD

          'Tickets' as Source,

          Date(Floor([Interaction Created Timestamp])) as Date,

          [Interaction Created Timestamp] as Dateformat,

          'ITSM Created' as DateFlag

FROM

source.xlsx

(ooxml, embedded labels, table is Report);

-Rob

View solution in original post

3 Replies
shree909
Partner - Specialist II
Partner - Specialist II

Hi use this expression in the script to calculate the dates

=Date(Date#(SubField(Date,' ',-2),'MM/DD/YYYY'),'DD/MM')   AS DateMonth for date and month

=Date(Date#(SubField(Date,' ',-2),'MM/DD/YYYY'),'DD/YYYY')  As DateYear

or

=Date(Date#(SubField(Date,' ',1),'MM/DD/YYYY'),'DD/MM')   AS DateMonth for date and month

=Date(Date#(SubField(Date,' ',1),'MM/DD/YYYY'),'DD/YYYY') 

replace date with [Interaction Created Timestamp]  field..

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I would approach it like this. [The Interaction Created Timestamp] is being correctly interpreted. You'll need to floor() that field to get just the date portion. Then you can use a preceding load to create additional fields from the Date.

Tickets:

LOAD

          *,

          Date(MonthStart(Date),'MMM-YYYY') as MonthYear,

            Month(Date) as DateMonth,

           Year(Date) as DateYear

;

LOAD

          'Tickets' as Source,

          Date(Floor([Interaction Created Timestamp])) as Date,

          [Interaction Created Timestamp] as Dateformat,

          'ITSM Created' as DateFlag

FROM

source.xlsx

(ooxml, embedded labels, table is Report);

-Rob

Not applicable
Author

Works perfectly! Thank you so much!