NOTE: inc is the folder containing ALL the javascript code used here.
JIFFormattedDateOutput.html – Usage of various date/time elements. Static date/time output.
Sample Output and Set Arbitrary Date
Output of Some Elements
Usage of date elements – simple instruction and sample code.
Predefined Date/Time Scrips
Table of Predefined Scripts
Output of ALL Available Date Elements
Specify Any Date For Output
–
| format character | Description | Example returned values |
|---|---|---|
| Day | ||
| d | Day of the month, 2 digits with leading zeros | 01 to 31 |
| D | A textual representation of a day, three letters | Mon through Sun |
| j | Day of the month without leading zeros | 1 to 31 |
| l | A full textual representation of the day of the week | Sunday through Saturday |
| N | ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0) | 1 (for Monday) through 7 (for Sunday) |
| S | English ordinal suffix for the day of the month, 2 characters, regular text | st, nd, rd or th. Used with j |
| X | English ordinal suffix for the day of the month, 2 superscript characters | st, nd, rd or th. Works well with j |
| w | Numeric representation of the day of the week | 0 (for Sunday) through 6 (for Saturday) |
| z | The day of the year (starting from 0) | 0 through 365 |
| Week | ||
| W | ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0) | Example: 42 (the 42nd week in the year) |
| Month | ||
| F | A full textual representation of a month, such as January or March | January through December |
| m | Numeric representation of a month, with leading zeros | 01 through 12 |
| M | A short textual representation of a month, three letters | Jan through Dec |
| n | Numeric representation of a month, without leading zeros | 1 through 12 |
| t | Number of days in the given month | 28 through 31 |
| Year | ||
| L | Whether it’s a leap year | 1 if it is a leap year, 0 otherwise. |
| o | ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0) | Examples: 1999 or 2043 |
| Y | A full numeric representation of a year, 4 digits | Examples: 1999 or 2043 |
| y | A two digit representation of a year | Examples: 99 or 43 |
| Time | ||
| a | Lowercase Ante meridiem and Post meridiem | am or pm |
| A | Uppercase Ante meridiem and Post meridiem | AM or PM |
| B | Swatch Internet time | 000 through 999 |
| g | 12-hour format of an hour without leading zeros | 1 through 12 |
| G | 24-hour format of an hour without leading zeros | 0 through 23 |
| h | 12-hour format of an hour with leading zeros | 01 through 12 |
| H | 24-hour format of an hour with leading zeros | 00 through 23 |
| i | Minutes with leading zeros | 00 to 59 |
| s | Seconds, with leading zeros | 00 through 59 |
| Timezone | ||
| e (unsuported) | Timezone identifier (added in PHP 5.1.0) | Examples: UTC, GMT, Atlantic/Azores |
| I | Whether or not the date is in daylights savings time | 1 if Daylight Savings Time, 0 otherwise. |
| O | Difference to Greenwich time (GMT) in hours | Example: +0200 |
| P | Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3) | Example: +02:00 |
| T | Timezone setting of this machine | Examples: EST, MDT … |
| Z | Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. | -43200 through 43200 |
| Full Date/Time | ||
| c | ISO 8601 date (added in PHP 5) | 2004-02-12T15:19:21+00:00 |
| r | RFC 2822 formatted date | Example: Thu, 21 Dec 2000 16:01:07 +0200 |
| U | Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) | See also time() |
Author's Site
More Date Stuff
Javascript Tutorial

=================================================================
Today's Date
Set Arbitrary Date – Display selected elements formatted
Sample Set Arbitrary Date & Time
Year, Month, Day, Hour, Minutes, Seconds
Since Month in javascript starts with 0 for January, months are always specified 1 less than you expect (i.e. January = 0 March = 2 December = 11).
<script type="text/javascript">
var MyDateTime=new Date(1943, 2, 6, 6, 55, 6);
document.write(MyDateTime.format('<b>'+' l\\, F jX Y \\@ h\\:i\\:s A')+'</b><br><br>');
</script>
In ISO format

Suffix can vary from st, as in 1st - nd, as in 22nd - rd as in 3rd to the most common th as in 26th.
Common usage of the suffix is as superscript; as in 6th or as 6th
Today's suffixX superscript suffix =
today's suffixS standard suffix =
DateStamp.js – – predefined font size 2 and predefined colour
DateStamp4.js – – predefined font size 4 and predefined colour
TodaysDate.js – Just the Month and date, allows unique message and font declaration
If you wanted to do something on it's time
to get on with it.
If you were born on ,
have a
VERY
HAPPY
BIRTHDAY!
Even if you were not born on ,
HAVE
A
GREAT
DAY!
Today's superscript Suffix is:
<script type="text/javascript">src="inc\suffixX.js"></script>
BOLD Suffix is
Today is the:
Standard suffix is:
<script type="text/javascript">src="inc\suffixS.js"></script>
As in Today is:
JIFDateFormatCode.js – The main Javascript code. MUST be specified
in head section of web page.
=================================================================
You may use a predefined script in the body section where date time stamp is required.
Usage may be as: This year is
This page was loaded at:
The coding of the previous line is:
<script type="text/javascript">
document.write("This page was loaded "+(myDate.format('l\\, F jX Y \\@ h\\:i A')+'<br>'));
</script>

Date Functions & Usage
To format Date/Time elements you wish to displayed on a web page.
requires the following in the head section of each html page
<script type="text/javascript" src="inc/JIFDateFormatCode.js"></script>
<script type="text/javascript" src="inc/StampDateTime.js"></script>
The result is displayed below with centred formatting
You may include additional text as below: (in red)
This page was loaded
The date may be output in BOLD if desired as follows.
Today is
Custom date elements from the table above.
Following is sample code in the body section of your page,
where date output is required.
(YOU may wish to select different date elements from the above table)
<script type="text/javascript">
var myDate = new Date();
document.write(myDate.format('F jX Y \\p\\a\\g\\e\\ \\l\\o\\a\\d\\e\\d \\@ h\\:i A')+'<br>');
</script>
displays the date as below
OR simple code for simple elements such as month date Year
<script type="text/javascript">
var myDate = new Date();
document.write(myDate.format('F jX Y '));
</script>
To display:

Requires the following in the head section of every html page using Date/Time elements.
<script type="text/javascript" src="inc/JIFDateFormatCode.js"></script>
Both of these have line break at the end (any following text appears on new line)
Predifined date stamp: –
inc/MyDateTimeStamp.js with results below (always BOLD)
Script file is hard coded for BOLD output. There are better ways to create
bold output but this is just a sample of "how to".
Requires the following at the location this date/time stamp is to be used
<script type="text/javascript" src="inc/MyDateTimeStamp.js"></script>
Result is:
Code looks like this
<script type="text/javascript">
var myDate = new Date();
document.write(myDate.format('<b>'+' l\\, F jX Y \\@ h\\:i A')+'</b>');
</script>
Predifined date stamp: –
inc/StampDateTime.js with results below (uses regular text)
Requires the following at the location this date/time stamp is to be used
<script type="text/javascript" src="inc/StampDateTime.js"></script>
The output result is:
Code looks like this
<script type="text/javascript">
var myDate = new Date();
document.write(myDate.format(l\\, F jX Y \\@ h\\:i A'));
</script>
Predifined Today's date (Month daysuffix): –
inc/TodaysDate.js with results below (uses regular text)
Requires the following at the location this date/time stamp is to be used
<script type="text/javascript" src="inc/TodaysDate.js"></script>
The output result is:
Predifined Date (Day Month datesuffix): –
inc/DayMonthDate.js with results below (uses regular text)
Requires the following at the location this date/time stamp is to be used
<script type="text/javascript" src="inc/DayMonthDate.js"></script>
The output result is:
Predifined Date (mm/dd/YYYY): –
inc/TodayIs.js with results below (uses regular text)
Requires the following at the location this date/time stamp is to be used
<script type="text/javascript" src="inc/TodayIs.js"></script>
The output result is:
You may combine two or more sripts if wou wish
inc/DayMonthDate.js followed by inc/TimeOnly.js
Today is
this page was loaded at
Display the day number of the current year as
inc/daycount.js – No line feed before but line feed after.
The output result is:
Can be combined with other scripts:
Today is inc/TodaysDate.js, inc/daycount.js With the following result:
Today is ,
ISO Date is used throughout the world to eliminate confusion with various date formats.
Using Apr or April works in English but not so well in French, Japanese etc...
03/06/02 Without firm standards, can and has been interpreted as
March 6th 2002 (US Usage (mm/dd/YY) - another example of US wnating to be different. I have always used this format (worked for US company))
June 3rd 2002 (UK & Canadian Usage (dd/mm/yy) and others used this format for centuries).
2nd of June 2003 – (yy/mm/dd)
Many forms specify the sequence that must be used to avoid confusion.
The ISO standard used throughout the world is YYYY-MM-DD
Some Europeans used YYYY.MM.DD before ISO and probably still do.
Back in the early days of computers, when every byte of memory was crucial, since
memory was expensive and most computers had in the neighbourhood of 16 Kb total; unlike
today with several megabytes at their disposal, two digit years saved significant
resources. Today of course memory is not only cheap but abundant, facilitating four
digit years without a second thought. Usage of two digit years has been typically a
North American phenomenon. Using the four digit year certainly eliminates
any ambiguity.
Predifined ISO Date (YYYY-MM-DD): –
inc/ISODate.js results below
Requires the following at the location this date/time stamp is to be used
<script type="text/javascript" src="inc/ISODate.js"></script>
The output result is:
ISO Time format is based on the military time format. Using the 24 hour time as opposed to the british AM or PM designation avoids ambiguity throughout the world.
ISO uses : to seperate time elements HH:MM:SS whereas military time does NOT.
ISO Time could be 23:15:00 military equivalent is 231500
(11:15:00 PM)
Predifined ISO Date/Time (YYYY-MM-DD HH:MM:SS): –
inc/ISODateTime.js with results below
Requires the following at the location ISO date/time stamp is to be used
<script type="text/javascript" src="inc/ISODateTime.js"></script>
The output result is:
Predifined ISO Time (HH:MM:SS): –
inc/ISOTime.js with results below
Requires the following at the location ISO time stamp is to be used
<script type="text/javascript" src="inc/ISOTime.js"></script>
The output result is:
Predifined ISO Date Time (YYYY-MM-DD @ HH:MM:SS): –
inc/ISODateTimeStamp.js with results below
Requires the following at the location ISO date time stamp is to be used
<script type="text/javascript" src="inc/ISODateTimeStamp.js"></script>
The output result is:
May be useful as:
Our flight home will be,
It is worth noting here that virtually all calendars we have start with Sunday
as the first day of the week, based on Judeo-Christian interpretation. The ISO calendar
starts the week on Monday. The debate may rage and standards may change but
some say He rested on the seventh day. Some would argue that we work and toil for 5-6 days and Sunday (the seventh day) is the day of rest, the day we give to the Lord. Some
give Saturday while others dedicate Thursday to their creator.

High time for standardisation but universal usage is some time away.
Prerequisite is JIFDateFormatCode.js in head section of each page using the date elements.
<script type="text/javascript" src="inc/JIFDateFormatCode.js"></script>
Insert the following where output is required.
<script type="text/javascript" src="inc/NAME.js"></script>
Substitute appropriate javascript name for
NAME to produce desired output.
| Date and Time Elements – Predefined Scripts Summary | ||
|---|---|---|
| Prerequisite is JIFDateFormatCode.js in head section | ||
| javascript name | Output | Linebreak |
| StampDateTime.js | NO | |
| StampDateTimes.js | NO | |
| MyDateTimeStamp.js | NO | |
| MyDateTimeStamps.js | NO | |
| StampDate.js | NO | |
| FullDayMonthDate.js | NO | |
| DateStampOnly.js | NO | |
| DayMonthDate.js | NO | |
| TimeOnly.js | NO | |
| MilitaryTime.js | NO | |
| TodaysDate.js | NO | |
| TodayIs.js | NO | |
| suffixX.js | NO | |
| suffixS.js | NO | |
| LastModifyDate.js | YES | |
| LastModifyDatehr.js | YES | |
| LastModifyDate4hr.js | YES | |
| daycount.js | NO | |
| daynumber.js | NO | |
| daysremaining1.js | NO | |
| daysremaining.js | NO | |
| days2xmas1.js | NO | |
| days2xmas.js | NO | |
| VictoriaDay.js | NO | |
| WeekNumber.js | NO | |
| ISODate.js | NO | |
| ISOTime.js | NO | |
| ISODateTime.js | NO | |
| LocalISODateTime.js | NO | |
| ISODateTimeStamp.js | NO | |
This FUNCTION allows user to specify a date and have it displayed as follows
DayName, MothName Datesuffix Year
Output =
Usage is:
Must have link
inc/Date_Day-Month-Names.js in header section
<script type="text/javascript" src="inc/Date_Day-Month-Names.js">
Specifying the date to be displayed is as follows:
<script>
var od = new Date(1943, 2, 6);
jdate(od)
</script>
Displays the date as:
Only the date format is hard coded, the output can be specified / modified in the html code as:
–
–
Coded without prerequisites (stand-alone javascript), preferable to use above scripts.
These Do NOT require JIFDateFormatCode.js in head section
TodayOnly.js =
DateStamp.js =
predefined font colour and font size.
DateStamp4.js =
predefined font colour and font size.
LastModifyDate.js =
predefined font colour and font size indicating date of last update.
Linebreak after output.
LastModifyDatehr.js =
predefined font colour and size indicating date of last update, including hour. Linebreak after output.
date.js –
Usage Samples
DateStampOnly.js –
allows unique message and font declaration
DayMonthDate.js –
allows unique message and font declaration

=================================================================
DAY
=================================================================
WEEK
=================================================================
MONTH
=================================================================
YEAR
=================================================================
TIME
=================================================================
TIME ZONES
=================================================================
FULL DATE/TIME
=================================================================
View/Print Output of All Variables
NOTE: Live date below has running clock instead of Static Date and Time
Font, Font Size, Font Colour and Text are defined in the inc/LiveDate.js code called in head section.
Requires <script type="text/javascript" src="inc/LiveDate.js"></script> in head section.
LiveDate.js – May be invoked only once per web page – predefined font colour and font size.
Add following code where live date is to appear:
<body onload="goforit()"><span id="clock"></span>