Time String.



Script unchangables in Blue
Script changables in Red
This script works in, IE 5+, Firefox 3+, Opera 10+ & Google Chrome 4.

Description:
This Script is a String containing the Date, a Clock with the Year Week plus Year Day.

It allows you to choose the Font Colour, Size, Type and also a different colour for the Date, Clock, Year Week & Year Day. You can also change the Table Border Size, Border Colour, BG Colour, Cell Spacing and Padding.

<script language="JavaScript">
function timeString(){

// Global Veribles

These are the Most common fonts used on the WWW. are Arial, Courier, Courier New, Georgia, Helvetica, sans-serif, Times New Roman, Verdana.

It is best to put it Family Format incase they DO NOT have your choosen font.

To Change the Font Face.
var fFace="Helvetica, Arial, Times New Roman";

To Change the Colour of the Font
var fontCol= "#000000";

To Change the size of the Font
var fontSz = "4";

To Change the Colour of the Information
var infoCol= "#ff0000";

To size the Border of the Table. Zero = None
var bordSz="0";

To Colour the Border of the Table
var bordCol="#ff0000";

The Distance the Text sits from Table Edge
var cellPad= "5";

The Distance the Inner Border sits from Table Edge. Zero = None
var cellSpace= "0";

To Change the Back Ground Colour of the Table
var BGcol= "#000000";

DO NOT CHANGE PAST HERE

To get new instace of the Date Function
var thisDate = new Date();

To get a Full Date of the Day
var thisDay = new Date(thisDate.getFullYear(), thisDate.getMonth(), thisDate.getDate(), 4, 0, 0)

To find the end of the year
var yrsEnd = new Date(thisDate.getFullYear()-1, 11, 31, 6, 0, 0);

To find the day of the year
var today = Math.ceil((thisDay.getTime()-yrsEnd.getTime())/(1000 * 60 * 60 * 24));

To get the Start of the Week
var startWeek = today;

To call the day of the year
var upper= today;

To get the Month
var thisMonth = thisDate.getMonth();

To the the Year
var thisYear = thisDate.getYear();

To call the Month
var num= thisDate.getDate();

To put on an End of Font Tag
var endF="</font>";

To make a shortened version of month or week just change the January Etc. & Sunday Etc. to Jan. & Sun.

To get the days of the week in written form. var thisDay= Array("Sunday", "Monday", "Tuesday" ,"Wednesday", "Thursday", "Friday", "Saturday");

To get the Months of the Year in written form.
var WordMonth= Array("January", "February", "March" ,"April", "May", "Friday", "June", "July", "August" ,"September", "October", "November", "December");

To write the Month from the Array WordMonth
var thisMonth=WordMonth[thisMonth];

// To get todays date
var day=thisDate.getDate();

// To call the todays date
var upper2= day;

Turn days to weeks
var day=thisDate.getDate();
if( yrsEnd.getDay() <6)
startWeek += yrsEnd.getDay() + 1;
Week = Math.ceil((startWeek)/7);

To write the st, nd, rd and th behind the days in the year.
if ((upper==1)||(upper==21)||(upper==31)||and so on and so forth all on one line ||(upper==351)||(upper==361)){
upper="<sup>st</sup>";
}
// end If

else if ((upper==2)||(upper==220)||(upper==32)||and so on and so forth all on one line ||(upper==352)||(upper==362)){
upper="<sup>nd</sup>";
}
// end elseIf

else if ((upper==3)||(upper==23)||(upper==33)||and so on and so forth all on one line ||(upper==353)||(upper==363)){
upper="<sup>rd</sup>";
}
// end elseIf

else {
upper="<sup>th</sup>";
}
// end else

To write the st, nd, rd and th behind todays date.
if ((upper2==1)||(upper2==21)||(upper2==31)||and so on and so forth all on one line ||(upper2==351)||(upper2==361)){
upper="<sup>st</sup>";
}
// end If

else if ((upper2==2)||(upper2==220)||(upper2==32)||and so on and so forth all on one line ||(upper2==352)||(upper2==362)){
upper="<sup>nd</sup>";
}
// end elseIf

else if ((upper2==3)||(upper2==23)||(upper2==33)||and so on and so forth all on one line ||(upper2==353)||(upper2==363)){
upper="<sup>rd</sup>";
}
// end elseIf

else {
upper2="<sup>th</sup>";
}
// end else

Message to be Written
theString = ("<table bgcolor='"+BGcol+"' cellpadding='"+cellPad+"' cellspacing='"+cellSpace+"'style='border:"+bordSz+"px outset "+bordCol+"'><tr><td><font face=' "+fFace+" ' size=' "+fontSz+" ' color=' "+fontCol+"'> <b><center> Today&#8217;s date is <font color=' "+infoCol+" '>"+ thisDay[thisDate.getDay()] +', '+thisMonth+" " +day+upper2+", "+thisYear +endF+" at <font color=' "+infoCol+" '>" + thisDate.toLocaleTimeString()+ endF+ ".<br> It is Calendar Week <font color=' "+infoCol+" '>"+ Week+endF + " and today is the <font color=' "+infoCol+" '>"+today+upper+endF+ " of the year.</center></b>"+endF +"</td></tr></table>");

Write Message to Table
document.getElementById('getString').innerHTML = theString;

Set timeout for clock
setTimeout('timeString()',1000);
}
// END timeString
document.write("<table align='center' border='0'><tr><td id='getString'></td></tr></table>");
timeString();
</script>

If you use this email notification would be nice.

If using IE to Select and Copy this Time Sting JavaScript just left click.
Then use (Ctrl + V) to paste into the <BODY> tags in your document.
Otherwise place your curser in the text box and press (Ctrl + A) then (Ctrl + C)
then use (Ctrl +V) to paste into the <BODY> tags in your document.


C U
May you find Love and Peace in your life.
Gary.

 

 

BlueBar.gif





Visitor N°   
          

 

Free Text Counter.        
Counter added 09/02/2014.
     

Top