mike chambers | about

Insert Date / Time Objects version 1.05

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 :

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

Tags:
twitter github flickr behance