Hi,
I have a workflow that send a email to users in HTML. I'm having trouble formating the date feilds which display
2019-04-01 00:00:00.0
I want them to display DD/MM/YYYY
I'm not a coder but tried the following with no success.
I understand you need to put the date feild in a new object then reformate it. The custom date field is 'End Date'.
Sorry I know this is easy one for any coder...
Many Thanks
I have tried the following:
<html>
<body>
<h2>JavaScript toDateString()</h2>
<p>The toDateString() method converts a date to a date string:</p>
<p id="End date"></p>
<script>
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy");
String date = DATE_FORMAT.format(${issue.getAsHtml("End date")});
System.out.println("Today in dd-MM-yyyy format : " + date);format(format(, ), )
</script>
<script>
def d = new Date(0)
def tz = TimeZone.getTimeZone('GMT')
println d.format(${issue.getAsHtml("End date")}, tz)
</script>
</body>
</html>
<html>
<body>
<h2>JavaScript toDateString()</h2>
<p>The toDateString() method converts a date to a date string:</p>
<p id="demo"></p>
<script>
var d = ${issue.getAsHtml("End date")};
document.getElementById("demo").innerHTML = d.toDateString();
</script>
</body>
</html>
Result type:
String
Result value:
<html>
<body>
<h2>JavaScript toDateString()</h2>
<p>The toDateString() method converts a date to a date string:</p>
<p id="End date"></p>
<script>
SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd-MM-yyyy");
String date = DATE_FORMAT.format(2019-04-01 00:00:00.0);
System.out.println("Today in dd-MM-yyyy format : " + date);format(format(, ), )
</script>
<script>
def d = new Date(0)
def tz = TimeZone.getTimeZone('GMT')
println d.format(2019-04-01 00:00:00.0, tz)
</script>
</body>
</html>
<html>
<body>
<h2>JavaScript toDateString()</h2>
<p>The toDateString() method converts a date to a date string:</p>
<p id="demo"></p>
<script>
var d = 2019-04-01 00:00:00.0;
document.getElementById("demo").innerHTML = d.toDateString();
</script>
</body>
</html>