Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,969 members, 7,817,842 topics. Date: Saturday, 04 May 2024 at 09:01 PM

Date Script Needed - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Date Script Needed (671 Views)

Original Nairaland.com Script Needed Urgently! / Sms Script Needed / Java Script Needed For Wapsite (2) (3) (4)

(1) (Reply) (Go Down)

Date Script Needed by denobleman(m): 8:18am On Jan 12, 2009
Hey guys,

where can I get a free script that will be updating the date I have on my website http://www.i-goldmine.com?
Re: Date Script Needed by OmniPotens(m): 10:16am On Jan 12, 2009
In what language, PHP or JavaScript? Depending on whichever you want, search google asap to see over 1 million free results.

Happy New Week!
Re: Date Script Needed by yawatide(f): 1:27pm On Jan 12, 2009
I would advise you use javascript for your solution, assuming you are talking about displaying current date. Why? because unlike say, PHP/JSP that uses server time, Javascript uses browser time or time on the client's machine.

In other words, if the server is in Nigeria and I access your site at 7pm naija time, I will see 7pm on my browser in the US and that would be wrong cos it would be 1pm where I am. On the other hand, javascript would display 1pm on my end and 7pm on yours, again cos it goes by the client's clock, not the server.

As omni says, do some googling. You could also check out http://irt.org/script/script.htm or dynamicdrive.com

Good luck!
Re: Date Script Needed by Nobody: 11:41pm On Jan 15, 2009
yes, i was about ta chip in the server time/client time thing.
someone has.
Re: Date Script Needed by Albato(m): 10:00am On Jan 16, 2009
Re: Date Script Needed by teemy(m): 10:53pm On Jan 17, 2009
Add the current date to your page.
This script will add the date in the form dd month yyyy (eg. 7 January 2000). Just copy and paste it into the document where you want it to appear.

<script language="JavaScript">
<!--
function makeArray() {
for (i = 0; i<makeArray.arguments.length; i++)
this[i + 1] = makeArray.arguments[i];
}
var months = new makeArray('January','February','March','April','May','June', 'July','August','September','October','November','December');
var date = new Date();
var day = date.getDate();
var month = date.getMonth() + 1;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
document.write(day + " " + months[month] + " " + year);
//-->
</script>


Example 17 January 2009



--------------------------------------------------------------------------------

Document Last Modified (a more readable version)

Insert this code in your document where you want the page last modified date to appear.

<script language = 'JavaScript'>
<!--
function makeArray0() {
for (i = 0; i<makeArray0.arguments.length; i++)
this[i] = makeArray0.arguments[i];
}
var days = new makeArray0("Sunday","Monday","Tuesday","Wednesday","Thursday" ,"Friday","Saturday"wink;
var months = new makeArray0('January','February','March','April','May','June', 'July','August','September','October','November','December');
function nths(day) {
if (day == 1 || day == 21 || day == 31) return 'st';
if (day == 2 || day == 22) return 'nd';
if (day == 3 || day == 23) return 'rd';
return 'th';
}
function getCorrectedYear(year) {
year = year - 0;
if (year < 70) return (2000 + year);
if (year < 1900) return (1900 + year);
return year;
}
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
function padout(number) { return (number < 10) ? '0' + number : number; }
var last = document.lastModified;
var date = new Date(last);
var dateY2K = new Date(getCorrectedYear(date.getYear()),date.getMonth(),date.getDate());
document.write('Last Modified: '+ days[dateY2K.getDay()] + ' ' +
dateY2K.getDate() + nths(dateY2K.getDate()) + " " +
months[dateY2K.getMonth()] + ", " +
(y2k(dateY2K.getYear()))
);
//-->
</script>


Example Last Modified: Saturday 17th January, 2009



--------------------------------------------------------------------------------

Date Last Modified.
Use this script to show when your page was last modified.

<script language="javascript">
<!--
document.write('Last modified '+document.lastModified);
//-->
</script>

Last modified 01/17/2009 22:39:44

+++++++++++++++++++++++++++++++++++++++++++++++++



Hope they help. Cheers

(1) (Reply)

Software Developer/ Database Admin Needed Urgently / Amazing Informercial / Enabling Of Upcoming Event/birthday

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.