Call us Toll-Free:
1-800-218-1525
Live ChatEmail us

 Sponsors

last modified w timezones and options

Code Wizard, 12-30-2006

last modification of your script that keeps your specific timezone in mind automagically.

greetings all,
there is already a last modifed script here but this is better <G>.
well, at least i included more words.

basically, i've added two factors:
1) date variables to modify
2) timezones taken into account

here is a basic version of the code you'll use:

<?php
putenv("PHP_TZ=America/Los_Angeles");
echo "Last modified: " . date( "F d Y.", getlastmod() );
?>

now, notice the putenv("stuff"); , this is telling the script to output
pacific standard time. see link at bottom for list of time zones. it would
be nice if PST could be used but that's not how life words...unless of course
a class is created. hmm.

the echo'd "Last Modified" can be changed or eliminated. If eliminated, it will
look like:

<?php
echo date( "F d Y h:i:s", getlastmod() );
?>

for fun i also:
1) took out the timezone reference.
2) changed the variables

the variables "F d Y h:i:s" are very flexible.

for a list of variables and timezones, check out my tutorial on this topic:

theprojects.org/dev/lastmodified.html

let me know what you think and have a nice day.

philip
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions