How to set Date without the Time

How to remove the time when setting the date? I always get this result below

Tue Jul 30 2019 10:10:42 GMT+0800 (China Standard Time)

Use ExecuteScript_Sandbox with this code:

var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();

today = mm + '/' + dd + '/' + yyyy;
return today;

This will give you today’s date in the format of mm/dd/yyyy.

Simply change today = mm +'/'+ dd +'/'+ yyyy; to whatever format you wish

1 Like