Date formatting in the label display

Hi,

I wanted to apply the format-date () function with one of hidden value (hv_checklist_date) having date in the displaying label by using the below syntax

image

But its not working (below screenshot) as expected, so do we have any option to apply date formatting into the label.

image

Kindly suggest.

Thanks and regards,
Gurudayal Sahu

Hi Gurudayal,

I'm not sure if I fully understand your question. But the syntax for format-date accepts 2 arguments, a date(which you want to convert) and a string(a format in which you want to convert your date).

format-date(date(#form/hv_checklist_date), "%a, %e %b %Y")

If you're want to format current date, you can simply write

format-date(now(), "%a, %e %b %Y")

Hi Shivam,

It will work perfectly fine once it is defined through hidden value calculation field. But in this case,I wanted to apply format-date() function directly in the Label Text by referring the date saved in the hidden value field (hv_checklist_date) through image ,but it is not working, hence looking for the correct syntax, in case it support.

Hope i am able to share the required details.

Thanks and regards,
Sahu

I'm still not sure if I understand it correctly, but assuming that you want to save this date calculation to a Label, here's how you can do it.

  • You can have a hidden value(let's say calculated_date_hidden_val) that does the date calculation and then in your label you can add the display text as :
<output value="#form/calculated_date_hidden_val" />
  • Or, you can simply write the whole query in the output value on the display text of your label, like this:
<output value='format-date(now(), "%a, %e %b %Y")' /> 

Thanks for the reply, it worked!

<output value='format-date(now(), "%a, %e %b %Y")' /> 

I was not sure that, even the above syntax can work directly without referring any case / form properties field value.

This is helpful.

Thanks and regards,
Gurudayal Sahu