+ Reply to Thread
Results 1 to 8 of 8




  

Thread: Adding date/time

      
  1. #1
    Grand Masters grim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond repute grim's Avatar
    Join Date
    September 22, 2006
    Posts
    10,060
    Rep Power
    25
    Feedback Score
    0

    Default Adding date/time

    I want to add the date/time to my php enabled shopping carts. Main reason, to show even a slight update when the search engines crawl.

    Anyone have a good code for this?

  2. #2
    Super Moderator tsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to behold tsdesigns's Avatar
    Join Date
    February 6, 2008
    Location
    Scotland
    Posts
    1,078
    Rep Power
    6
    Feedback Score
    0

    Default Re: Adding date/time

    You could use JavaScript to show the date/time of the user visiting the site or PHP to show the date/time of the server or the date/time of the user (like JS does).

    Which is it you'd be looking to use?

    Edit: my bad, PHP might only be able to show the server time/date - I thought it could do both O.o

  3. #3
    Grand Masters grim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond reputegrim has a reputation beyond repute grim's Avatar
    Join Date
    September 22, 2006
    Posts
    10,060
    Rep Power
    25
    Feedback Score
    0

    Default Re: Adding date/time

    Was mainly just looking for something to add to my main sites for the page to look 'updated' to the search engine bots

  4. #4
    Super Moderator tsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to beholdtsdesigns is a splendid one to behold tsdesigns's Avatar
    Join Date
    February 6, 2008
    Location
    Scotland
    Posts
    1,078
    Rep Power
    6
    Feedback Score
    0

    Default Re: Adding date/time

    PHP would probably be better (as it will work in all browsers - including old ones and those that disable Javascript):

    Code:
    <?php
    $time_offset ="0"; // Change this to your time zone
    $time_a = ($time_offset * 120);
    $time = date("h:i:s",time() + $time_a);
    echo 'Current time is : '.$time;
    ?>
    That'll display:
    Current time is : HH : MM : SS

    If you'd like the date too then add this:

    Code:
    <?php
    $date = strftime("%A, %d %B, %Y");
    echo $date;
    ?>
    That displays the date in the format of:
    day, date month , year
    e.g. Saturday, 10 October , 2009

    But Javascript is probably easier to add, here we are:

    Code:
    <SCRIPT Language="JavaScript">
    <!-- hide from old browsers
      var curDateTime = new Date()
      document.write(curDateTime.toGMTString())
    //-->
    </SCRIPT>
    That will display the current GMT time.

    e.g. Sat, 10 Oct 2009 23:29:19 GMT

    More about the JavaScript can be found here:
    JavaScript Code 4 U - Date & Time

    Enjoy

  5. #5
    Permanently Banned ViroNetworks is on a distinguished road
    Join Date
    October 10, 2009
    Location
    Michigan
    Posts
    55
    Rep Power
    0
    Feedback Score
    0

    Default Re: Adding date/time

    Thanks tsdesigns, I can use that on a couple of my sites.

  6. #6
    Permanently Banned Ryan Viro is on a distinguished road
    Join Date
    October 10, 2009
    Location
    New York
    Posts
    26
    Rep Power
    0
    Feedback Score
    0

    Default Re: Adding date/time

    thanks tsdesigns. very useful

  7. #7
    I'm New! hostingguru is on a distinguished road
    Join Date
    January 27, 2011
    Posts
    13
    Rep Power
    2
    Feedback Score
    0

    Default Re: Adding date/time

    great info man thanks for sharing with us. keep sharing with us.

  8. #8
    I'm New! edision is on a distinguished road
    Join Date
    August 10, 2011
    Posts
    11
    Rep Power
    1
    Feedback Score
    0

    Default Re: Adding date/time

    it can be done by PHP but more power full if you are using Java Script for this

    you can find more script for that on the google

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Greatest Invention (To date anyway)
    By GordyMac in forum Forum Lounge
    Replies: 4
    Last Post: Feb 8th, 2009, 7:31 pm
  2. Need A Date For New Year's Eve???
    By Zap in forum Forum Lounge
    Replies: 9
    Last Post: Jan 2nd, 2008, 10:22 am
  3. ANd also on this date, October 1st....
    By iowadawg in forum Forum Lounge
    Replies: 3
    Last Post: Oct 2nd, 2007, 9:27 am
  4. On this date in 1948
    By iowadawg in forum Forum Lounge
    Replies: 1
    Last Post: Sep 10th, 2007, 6:29 am
  5. How much time do you spend adding quality links?
    By dvduval in forum Directories
    Replies: 7
    Last Post: Jan 23rd, 2007, 10:27 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
WebTalkForums
WebTalkForums
Recent Forum Threads