Last updated date???

  • Thread starter Thread starter Crystal
  • Start date Start date
C

Crystal

Is there anyway to include on a presentation's master
slide or any slide a date that automatically changes only
when you save or update the information on the slide???
I have been able to put a date that changes when you open
the slide, but I want it only to change if someone had
made changes and saved it (i.e. Last updated: September
15, 2004)
 
Dear User,

You can use this code :

Getting the date last updated of a file, in your timezone - by Switch


If you have ever wanted to get that "Page last updated/modified on blah
blah" on one of your pages, but also wanted it displayed in your timezone,
well you are in luck ;) Just read on!

As always, start with the <?php bit.
<?php

Now, using he filemtime() function, we will give the variable $modified a
value of when the file index.php was last modified.
$modified = filemtime("index.php");

Next, we will define the time offset from the server, so we can display the
correct modification time (for more on this, you might want to visit my
getting the date and time in your timezone tutorial).
$offset = 3600*10;

Righto, now using the 2 variables we set, $modified and $offset, we will
define the time using gmdate().
$date = gmdate("dS F Y, G:i", $modified + $offset);

Then, we output the date with a little message and finish off the PHP
script.
echo "Last Modified On: $date";
?>

Here is the complete code:

<?php
$modified = filemtime("index.php");
$offset = 3600*10;
$date = gmdate("dS F Y, G:i", $modified + $offset);
echo "Last Modified On: $date";
?>

To make this script suit your needs, there are a number of things that you
can change. Firstly, of course, you can change the file name in filemtime().
You can also change the number 10 in $offset to suit your needs. You can
change the "dS F Y, G:i" in gmdate() to display the date and time how you
need it, and you can change what is echoed in the echo tag. I hope that
tutorial was useful to you, because it was useful to me :)

Suvodip Moitra
 
Back
Top