...

View Full Version : Need to Post the Current Date in my Page



php_stud
04-05-2004, 09:22 AM
Guys, how can i do this in PHP?

<<<< Today is Day, Month Date, Year >>>

Tnx.

raf
04-05-2004, 09:40 AM
Welcome here !

check out http://www.php.net/manual/en/function.date.php for all possible date-pars in all possible forms.

you'll need something like



echo ('<<<< Today is' . date ("d, m, Y") . ' >>>>');

missing-score
04-05-2004, 12:04 PM
hi, you need to do it slightly differently to that:


<?php
echo "<<< Today is Day ".date("d").", Month ".date("m").", Year ".date("Y")." >>>";
?>

Like raf said, you can lookup the possible letters on the php.net link that he gave you.

raf
04-05-2004, 12:22 PM
hi, you need to do it slightly differently to that:


<?php
echo "<<< Today is Day ".date("d").", Month ".date("m").", Year ".date("Y")." >>>";
?>
Hmm. Different reading. I thought the Day etc needed to be replaced by the day. Maybe he just needs


echo('<<<< Today is Day, Month Date, Year >>>');

:D

php_stud,

if the url and posted code doesn't get you there, post an example of the exact format you want it to be printed.

missing-score
04-05-2004, 12:27 PM
raf: What i meant was not the format, but in your code you put:


<?php
date (d, m, Y);
?>

Which isnt going to work becuase you have 3 arguments, none of which are strings, and the date function has 2 arguments... The first argument has the format and the second (an optional timestamp).

Or just thought, maybe im reading it wrong and you meant:


<?php
date("d, m, y");
?>

(either way, you still missed some quotes :)

raf
04-05-2004, 12:35 PM
:o eek. Indeed. Missed the quotes. (old age ... bad eyes ... to much wine ...) I've edited the code i posted to avoid confusion.

thanks missing-score.

php_stud
04-06-2004, 01:38 AM
Thanks a million... this is the format that I prefer...

echo "Today is ".date("l").", ".date("F")." ".date("d").", ".date("Y");

dswimboy
04-06-2004, 03:20 AM
sorry, wanted to make new thread. this is a dummy edit

raf
04-06-2004, 07:32 AM
Thanks a million... this is the format that I prefer...

echo "Today is ".date("l").", ".date("F")." ".date("d").", ".date("Y");
this is a bit shorter and more efficient


echo 'Today is '. date("l, F d, Y");



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum