Page 1 of 1

php help needed

Posted: Sun 29 Aug 2010 1:10 am
by n9mfk

Code: Select all

<?php print "<center>Page last modified: " . date ("D M j Y  H:i.", filemtime($page_name))."</center>";?>

Code: Select all

I Like to add a at before the time but im not sure how to do it  date ("D M j Y  H:i.", an not make it part of the date 
thanks beau

Re: php help needed

Posted: Sun 29 Aug 2010 1:41 am
by gemini06720
How about something like this:

Code: Select all

<div style="text-align: center;">Page last modified: <?php echo date ("D M j Y @ H:i", filemtime($page_name)); ?>.</div>
I do not like using the HTML '<center></center>' elements - I prefer using the CSS 'text-align: <value>' property.

If you want to ensure that the text appears properly space between two other lines of text you could use the following:

Code: Select all

<p style="text-align: center;">Page last modified: <?php echo date ("D M j Y @ H:i", filemtime($page_name)); ?>.</p>
Text can be used with the PHP 'date()' function as long as each text letter is preceded by a single '\' (or a double '\\' in case of an established parameter, such as most of the characters used in the following example):

Code: Select all

<?php echo date ("\\T\\o\\d\\a\\y\'\\s \\d\\a\\t\\e \\i\\s F j, Y \\a\\n\\d \\t\\h\\e \\t\\i\\m\\e \\i\\s H:i"); ?>

Re: php help needed

Posted: Sun 29 Aug 2010 9:17 am
by serowe
n9mfk wrote:

Code: Select all

<?php print "<center>Page last modified: " . date ("D M j Y  H:i.", filemtime($page_name))."</center>";?>

Code: Select all

I Like to add a at before the time but im not sure how to do it  date ("D M j Y  H:i.", an not make it part of the date 
thanks beau
The best way is to use php.net eg:

http://au2.php.net/manual/en/function.date.php

When you want help on a function just call php.net with the funciton after it as I did in the above URL.

HTH