1

I am using

var TIMESTAMP_FORMAT = "yyyy-MM-dd hh:mm:ss a";
var TZ = "GMT-7";

in my script code of Google document

I want it to be convert into 24 hrs timestamp

What changes should I do ?

1 Answer 1

1
  1. Replace hh by HH
  2. Remove a

Example

function myFunction() {
  var TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss";
  var date = Utilities.formatDate(new Date(2020,5,5,18,23,3), Session.getScriptTimeZone(), TIMESTAMP_FORMAT);
  Logger.log(date)
};

Reference

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.