date code

This is a discussion on "date code" within the JavaScript Forum section. This forum, and the thread "date code are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 24th, 2008, 22:06
Junior Member
Join Date: Dec 2007
Location: london
Age: 35
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
date code

Hi all,

I would like to display the current date on my site. Before posting I did try to search this forum but code not find anything.

Can anyone help please?

Regards. John.
Reply With Quote

  #2 (permalink)  
Old Feb 24th, 2008, 23:33
unitedcraig's Avatar
SuperMember

SuperMember
Join Date: Oct 2007
Location: Stockport
Age: 17
Posts: 825
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: date code

You can do this using JS, here a link i found through google

http://www.webreference.com/js/scripts/basic_date/

hope this helps

Craig

*staff move to JS forum*
__________________
Last Blog Entry: A Royal Mistake (Feb 20th, 2008)
Reply With Quote
  #3 (permalink)  
Old Feb 25th, 2008, 07:05
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
Re: date code

Or you easily use PHP.

Anyway, may I ask why you need the date on your page? Most people can look in the bottom right of their screen for the date on Windows (Hover over the time and it shows) so why does your website need to tell them again?
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote
  #4 (permalink)  
Old Feb 25th, 2008, 11:52
Reputable Member
Join Date: Oct 2007
Location: UK
Posts: 267
Thanks: 0
Thanked 0 Times in 0 Posts
Re: date code

Have a look at this link....

http://uk2.php.net/date

Or just google "php time and date".

Danny322
Reply With Quote
  #5 (permalink)  
Old Feb 25th, 2008, 19:52
Junior Member
Join Date: Dec 2007
Location: london
Age: 35
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Re: date code

Thanks for your help.

Firstly the reason I thought it would be a good idea to add the date was because I thought it may look good.

Secondly I have created my page in CSS and HTML, will the php code work within the html?

Regards. John.
Reply With Quote
  #6 (permalink)  
Old Feb 25th, 2008, 20:53
unitedcraig's Avatar
SuperMember

SuperMember
Join Date: Oct 2007
Location: Stockport
Age: 17
Posts: 825
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: date code

You would have to change your site to php, ill find a link for you in a second mate
__________________
Last Blog Entry: A Royal Mistake (Feb 20th, 2008)
Reply With Quote
  #7 (permalink)  
Old Feb 25th, 2008, 20:57
unitedcraig's Avatar
SuperMember

SuperMember
Join Date: Oct 2007
Location: Stockport
Age: 17
Posts: 825
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: date code

If you wanted to use php when you would have to replace the .html extension with .php, this also means that you would have to use a local server to test your pages.

[SOLVED] Change site to PHP

If you used Javascript then you can just use this in the HTML page without changing to php, this was why i recommended this method
__________________
Last Blog Entry: A Royal Mistake (Feb 20th, 2008)
Reply With Quote
  #8 (permalink)  
Old Feb 26th, 2008, 18:36
SuperMember

SuperMember
Join Date: Jun 2007
Location: uk
Posts: 459
Thanks: 0
Thanked 0 Times in 0 Posts
Re: date code

If you wish to use PHP then replace this code on your page.

HTML: Select all
 <p><b><font color="#FEE1D5">Today's date: 30 December 2007</font></b></p>
with this

HTML: Select all
<p><b><font color="#FEE1D5">Today's date: <?php echo date("l, F d, Y h:i" ,time());
?>
</font></b></p>
You would then have to save the file with a .php extension so your page would become

www.usbtvtuner.co.uk/tvstick6.php

If you used this code on eveery page then the php extension would have to be used.
This is assuming your host supports PHP.

Cheers

Pat
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
code behind code doesnt work skat ASP.NET Forum 4 Feb 18th, 2008 10:05
live search code and styleswitcher code hebel JavaScript Forum 0 May 12th, 2007 06:16
Changing date format in date picker AdRock JavaScript Forum 1 Aug 1st, 2006 17:16
Date in Asp Gup Classic ASP 1 Jun 5th, 2006 09:05
Can somebody give me the code to hide the source code? renren JavaScript Forum 7 Mar 7th, 2006 12:27


All times are GMT. The time now is 05:43.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43