Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Date Format Change

MLong1427
Level 2
Level 2

How can I change a date format of a field to use in an output?  This is different from using java in file naming.

 

YYYY-MM-DD hh:mm:ss

1 Accepted Solution
Jyoti_Y
Correct answer by
Community Advisor
Community Advisor

Hi,

1) If you are trying to change date format in Email Design :

You can change your date format by using Format expression.

Use below in your HTML code:

data-nl-format="%4Y-%2M-%2D %2h:%2n:%2s"

Something like this: 

<p >Booking Date:<span  data-nl-type="datetime"  data-nl-format="%4Y-%2M-%2D %2h:%2n:%2s">Booking Date </span></p>

 

2) If you are trying to change date format in a workflow, you can use below code:

const FORMAT_120 ="%4Y-%2M-%2D %2h:%2n:%2s"
instance.vars.workflowExecutionInitiatedAt=formatDate(date,FORMAT_120);

 

Thanks

View solution in original post

6 Replies
Jyoti_Y
Correct answer by
Community Advisor
Community Advisor

Hi,

1) If you are trying to change date format in Email Design :

You can change your date format by using Format expression.

Use below in your HTML code:

data-nl-format="%4Y-%2M-%2D %2h:%2n:%2s"

Something like this: 

<p >Booking Date:<span  data-nl-type="datetime"  data-nl-format="%4Y-%2M-%2D %2h:%2n:%2s">Booking Date </span></p>

 

2) If you are trying to change date format in a workflow, you can use below code:

const FORMAT_120 ="%4Y-%2M-%2D %2h:%2n:%2s"
instance.vars.workflowExecutionInitiatedAt=formatDate(date,FORMAT_120);

 

Thanks

View solution in original post

MarcelSzimonisz
Community Advisor
Community Advisor
@Jyoti_Y do you know where one can find these attributes such as data-nl-format is there a guide to them?
MarcelSzimonisz
Community Advisor
Community Advisor

1) does not work in email but you can see them in forms in web apps

Jyoti_Y
Community Advisor
Community Advisor

For email you need to use script provided in second point. Use them under

<% %> tags.

something like this:

<%

var FORMAT_120 ="%4Y-%2M-%2D %2h:%2n:%2s"
var workflowExecutionInitiatedAt=formatDate(date,FORMAT_120);

%>

and then display in email as : <%=workflowExecutionInitiatedAt%>

Manoj_Kumar_
Community Advisor
Community Advisor
Number 2 will work in Email. But Number 1 is not working in webForms.