Page 1 of 1

setting the date of the current year

Posted: Tue May 15, 2007 3:55 am
by pleigh
hi, is this correct, when i declare

Code: Select all

date();
, the output will be the date today. if that is correct, how about setting the variable date to something like the start of the year?

for example, i ant to declare the value of $startDate to the first week of the current year

thanks

Posted: Tue May 15, 2007 5:47 am
by N1gel
date("Y") should give you the current year.

so if you wanted the date off the first day off the year you could try.

Code: Select all

echo "01-01-".date("Y");
its cheap and cheerful but it gives you

01-01-2007

Posted: Tue May 15, 2007 7:39 pm
by pleigh
hi, thanks for the reply..but i was just wondering how can i integrate the date january 1 on this code

Code: Select all

$x = strtotime("last Monday");
$Year = date("Y",$x);
$Month = date("m",$x);
$Day = date("d",$x);
thanks againd.:)