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?
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?










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
Was mainly just looking for something to add to my main sites for the page to look 'updated' to the search engine bots![]()










PHP would probably be better (as it will work in all browsers - including old ones and those that disable Javascript):
That'll display: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; ?>
Current time is : HH : MM : SS
If you'd like the date too then add this:
That displays the date in the format of:Code:<?php $date = strftime("%A, %d %B, %Y"); echo $date; ?>
day, date month , year
e.g. Saturday, 10 October , 2009
But Javascript is probably easier to add, here we are:
That will display the current GMT time.Code:<SCRIPT Language="JavaScript"> <!-- hide from old browsers var curDateTime = new Date() document.write(curDateTime.toGMTString()) //--> </SCRIPT>
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![]()
Thanks tsdesigns, I can use that on a couple of my sites.
thanks tsdesigns. very useful
great info man thanks for sharing with us. keep sharing with us.
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks