Synthetic Classic has reached end of support and is no longer available. Existing Synthetic Classic customers have been upgraded to the all-in-one Dynatrace software intelligence platform.

Example date formatting

The code below is a sample to show the various functions that can be used for date formatting.

var now = new Date();
var MM = now.getMonth()+1;
var DD = now.getDate();
var YYYY = now.getFullYear();
var HH = now.getHours();
var NN = now.getMinutes();
var SS = now.getSeconds();
var slash = "/";
var colon = ":";
var formattedDate = MM + slash + DD + slash + YYYY + " " + HH + colon + NN + colon + SS;
alert (formattedDate);

A demo script can be downloaded here as well: sampleDateFormatting.gsl