Jump to content
xisto Community
wannabeeaweak

date for your site

Recommended Posts

here this script will display the date for your user/visitors

input it in a html file in the head or body

<script language="Javascript">

<!--

/*

Today's date script

Visit java-scripts.net or

http://www.javascriptkit.com/ for this script

*/

 

var dayName = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")

 

var monName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

 

var now = new Date

 

document.write("Today is " + dayName[now.getDay()] + ", " + monName[now.getMonth()] + " "+now.getDate() +".")

 

//-->

</script>

Share this post


Link to post
Share on other sites

Don't you people ever get tired of writin these scripts ??I've written this script and seen this script atleast 20 times.Please stop writing these basic scripts

Share this post


Link to post
Share on other sites

Javascript will work on any browser that supports it because it is client-side. PHP only works on servers in which it is installed

<{POST_SNAPBACK}>


And which do you think is best?

 

As a web designer, with which one you know that user is seeing a date?

 

 

And R3d Javascript is really worth learning. It isn't the best technology to get a date or time to your website but you can do lot of stuff that are really useful for your visitors. A typical example is manipulating form data on client side. For example, it is extremely useful to be able to check/uncheck all checkboxes at once.

My view is that Javascript shouldn't be used to replace server-side stuff but to do stuff that are useful (ie. not just flashy) but not possible or very clumsy with server-side program.

Share this post


Link to post
Share on other sites

The problem with JS is that it rely the user computer time, if the user computer date and time is not adjusted then the time showing will be inaccurate.For PHP it read the server time, no matter what date and time setting is made on the user computer the result will remain consistent and unaffected by the user computer setting.Most users will have no problem viewing becos PHP will return the time and date in plain text format whereas JS may have problem with users who choose to disable JS for security reasons and older browser that do not support JS.Hope the above explainations will help you to see what want you are choosing and what to expect.

Share this post


Link to post
Share on other sites

Don't you people ever get tired of writin these scripts ??

I've written this script and seen this script atleast 20 times.

 

Please stop writing these basic scripts

<{POST_SNAPBACK}>

Thank you :P finally somebody who agrees with me.

 

Even though I doubt he wrote it. I'm sure he copy pasted it from somewhere... *sigh*

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.