(JavaScript) Simple Date Functions
- Home
- Javascript
- (JavaScript) Simple Date Functions
The are many things you can do with dates using Javascript. The examples below illustrate several types of date displays;
How it Works
The script contains the basic Date values (eg. month, weekday, etc) necessary to perform almost any Date calculations or display any date format. It also contains several pre-written functions that create some useful date displays. Here's a list of the available date display functions:
- showGreeting() -
"Good Morning", "Good Afternoon" or "Good
Evening"
- showTime(type) -
"c" civilian time, "m" military time
- showDate(format) -
various date/time formats
- showCalendar() - a
calendar showing todays date
- showTimer() - elapsed
time
- showDays(when) - number
of days untill some event
Using the JavaScript
To implement this script, simply;
- copy the HTML below into a new page.
- add your scripts at the appropriate locations on the page. It should look something like this:
<script
language="JavaScript"><!--showDate("dddd,
mm dd, yyyy");// --></script>
The Result
You entered this page at () on
Christmas is days away!
javascript date functions date