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

Formatting dates in text boxes

Hi All,

I have a text box which displays the date from a listbox called 'Reporting_Date_Comp' when a date value is selected.

However, the values are not formatted.

For example, when I select '20130504' from the listbox, it will be displayed as 'Date: 20130504' in my text box.

Is there a way for me to format it such that it will be displayed as 'Date: 04/05/2013' instead?

Below is my working code in the text box:

='Date: ' & Reporting_Date_Comp

1 Solution

Accepted Solutions
Gysbert_Wassenaar

='Date: ' & date(Reporting_Date_Comp,'DD/MM/YYYY')

It's possible that Reporting_Date_Comp is not yet a date, just a number. In that case you need:

='Date: ' & date(date#(Reporting_Date_Comp,'YYYYMMDD'),'DD/MM/YYYY')

Actually it would be better to do this conversion in the script.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

='Date: ' & date(Reporting_Date_Comp,'DD/MM/YYYY')

It's possible that Reporting_Date_Comp is not yet a date, just a number. In that case you need:

='Date: ' & date(date#(Reporting_Date_Comp,'YYYYMMDD'),'DD/MM/YYYY')

Actually it would be better to do this conversion in the script.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

I did the same formatting before, but it gave me this instead

Date: 22/06/57015

Is it because of its numerical representation?

er_mohit
Master II
Master II

try this

='Date: ' & date(date#('20130504','YYYYMMDD'),'DD/MM/YYYY')

Replace this with your datefield

Not applicable
Author

I rewrote the script and it works! Thank you