Insert Date / Time Objects version 1.05

Created Thu, 05 Oct 2000 06:35:44 +0000 Modified Thu, 05 Oct 2000 06:35:44 +0000
199 Words

The Insert Date object and Insert Time object are custom Generator objects that make the server date and / or time available for use in a Macromedia Generator template.

You can specify that the time be formatted in 1 of 5 ways :

  • short
  • medium
  • long
  • full
  • raw

All of the formats except raw are determined by your server’s local settings. Raw format outputs the number of milliseconds since Midnight, GMT, January 1, 1970.

This object is useful for version control of templates during development, and for letting the user know when the template (and thus its information) were last updated (see the Insert Slashdot News demo).

Here is some sample Flash 5 code that uses the object to determine whether it is day or night where the server is located.

myDate = new Date("{serverDate}");
var serverHour = myDate.getHours();

if(serverHour < 6 || serverHour < 19)
{
    trace("it is day at the server");
}
else
{
    trace("it is night at the server");
}

Note that you have to put the Generator variable {serverDate} within quotes. There is a technote at Macromedia which explains this.

Download the object and its source from the Flash Exchange.

More info on Macromedia Generator