Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

conversion of date

Hi Community,

     I tried to change my date field from string to number.not able to resolve

     please help  me

1 Solution

Accepted Solutions
its_anandrjs

Hi Sruti,

Some of the very simple way try this load script for date, month and year

LOAD cust_id,

     date,

     Date(Date#(date,'DD-MM-YYYY')) as Date,

     Month(Date#(date,'DD-MM-YYYY')) as Month,

     Year(Date#(date,'DD-MM-YYYY')) as Year,

     sale,

     Date(Date#("date",'DD-M-YYYY')) as NewDate,

     Year(Date(Date#("date",'DD-M-YYYY'))) as NewYear,

     MOnth(Date(Date#("date",'DD-M-YYYY'))) as NewMonth

From

practice.xlsx

(ooxml, embedded labels, table is Sheet1);

View solution in original post

9 Replies
MK_QSL
MVP
MVP

=Date(Date#(date,'DD-M-YYYY'))

and

=NUM(Date(Date#(date,'DD-M-YYYY')))

ashfaq_haseeb
Champion III
Champion III

try below

Alt( Date(Date#( [date] , 'DD-MM-YYYY' ),'DD-MM-YYYY'),

      Date(Date#( [date] , 'DD-M-YYYY'),'DD-MM-YYYY')) AS NewDate,

Regards

ASHFAQ

suzel404
Creator
Creator

Attachement!

Not applicable
Author

= date(date#(date,'ddmmyyyy'))

Not applicable
Author

i want to dervie month and year fields how can i get that?

tresesco
MVP
MVP

Date(num(Date#([date] ,'DD-MM-YYYY')),'DD-MM-YYYY') as new_date,

can be written in an easier way like:

Date(Date#([date] ,'DD-MM-YYYY'),'DD-MM-YYYY') as new_date,

Month(Date#([date] ,'DD-MM-YYYY')) as new_Month,

Year(Date#([date] ,'DD-MM-YYYY')) as new_Year,

Not applicable
Author

year(= date(date#(date,'ddmmyyyy'))) as year,

month(= date(date#(date,'ddmmyyyy'))) as month

ashfaq_haseeb
Champion III
Champion III

Like this.

LOAD cust_id,

     date,

     Date(Date#(date,'DD-MM-YYYY')) as Date,

     Month(Date#(date,'DD-MM-YYYY')) as Month,

     Year(Date#(date,'DD-MM-YYYY')) as Year,

     sale

From

practice.xlsx

(ooxml, embedded labels, table is Sheet1);

Regards

ASHFAQ

its_anandrjs

Hi Sruti,

Some of the very simple way try this load script for date, month and year

LOAD cust_id,

     date,

     Date(Date#(date,'DD-MM-YYYY')) as Date,

     Month(Date#(date,'DD-MM-YYYY')) as Month,

     Year(Date#(date,'DD-MM-YYYY')) as Year,

     sale,

     Date(Date#("date",'DD-M-YYYY')) as NewDate,

     Year(Date(Date#("date",'DD-M-YYYY'))) as NewYear,

     MOnth(Date(Date#("date",'DD-M-YYYY'))) as NewMonth

From

practice.xlsx

(ooxml, embedded labels, table is Sheet1);