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>
String
<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>
Hi Kevin,
Can you try the following, you'll need to change the hardcoded date to extract the date you want first:
var d = new Date("2019-10-11 00:00:00.0");
var n = ("0"+d.getDate()).slice(-2) + "/"+ ("0"+(d.getMonth()+1)).slice(-2) + "/" + d.getFullYear();
n will now contain the date in the format 01/04/2019 and you can use this to export however you like.
Hope this helps!
Cheers,
Keri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.