Date format

Here is an easy tip about the date format.

[Date fomat] dd/MM/yyyy HH24:mm;ss

 

Source code

function getFormatDate() {
  var dt = new Date();
  var tz = "GMT+2:00";
  var fm = "dd/MM/yyyy HH:mm:ss";
  var res = Utilities.formatDate(dt, tz, fm);
  Browser.msgBox("Today: " + res);
}

 

Format

Utilities.formatDate(date, timezone, format)

 

Parameters

(1) date … Date value.

(2) timezone … Timezone. This parameter requires like “GMT+2:00”.

(3) format … Date format.

 

Responses

string

Leave a Comment