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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date format from text

I loaded a excel file which has a date field but when I tried to pull Day(FIELD),Month(FIELD) I am getting nothing, That field contains data for One month but still I am getting nothing for Day(Field)....please help me

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

You have to format to date if it is not in correct format

Assuming my date field is in the format MM-DD-YYYY then

Check with this

DateFormatting:

Load Day(FieldName) AS day,Month(FieldName) AS Month;

Load Date#(DateField,'MM-DD-YYYY') AS FieldName From ExcelDatasource;

Or

Load Day(Date#(DateField,'MM-DD-YYYY')) AS day,Month(Date#(DateField,'MM-DD-YYYY')) AS Month

From ExcelDatasource;

View solution in original post

3 Replies
MayilVahanan

HI

Try like this

Load *,day(Date) as Day, Month(Date) as Month;

Load *,Date#(DateField) as Date from excelfilename.xls;

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

You have to format to date if it is not in correct format

Assuming my date field is in the format MM-DD-YYYY then

Check with this

DateFormatting:

Load Day(FieldName) AS day,Month(FieldName) AS Month;

Load Date#(DateField,'MM-DD-YYYY') AS FieldName From ExcelDatasource;

Or

Load Day(Date#(DateField,'MM-DD-YYYY')) AS day,Month(Date#(DateField,'MM-DD-YYYY')) AS Month

From ExcelDatasource;

whiteline
Master II
Master II

Hi.

To be able to use Date functions you should store your date in field in a right format.

Actually dates has two parts: text and numeric. It seems that you have just string in FIELD so date functions doesn't work.

So you should convert it to make a date from string. There are functions with # in the end that converts string into dual.

Above you can see the example of conversion in script.

You can also try it in a chart/listbox to make sure that the statement is correct (if you have loaded FIELD separately).