Basic HTML version of Foils prepared 23 June 1997

Foil 44 JavaScript Date Objects

From JavaScript Tutorial for Certificate Course UC Web applications Certificate -- Summer 97. by Geoffrey C. Fox, Tom Scavo

Examples of JavaScript Date Object for Foil 44
JavaScript really needs the powerful text processing capabilities of PERL. (Lets hope either Netscape adds them or somebody builds them.) On the other hand, JavaScript (like Java) has 21 built-in methods associated with the Date object!
today = new Date(); // current Date and Time
now = new Date("February 26, 1996 15:13:00"); /* sets now to date/time these notes were prepared! */
Both Java and JavaScript store dates internally as number of elapsed milliseconds since January 1, 1970 00:00:00.
In a Java, Date.UTC(date as bunch of numbers) and Date.parse(date as a text string) are static methods
There are methods such as getMonth that extract the month from a date
See the online resource for all possible methods!



Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998