PDA

View Full Version : Dates, yesterday and tomorrow...


doggo18
08-18-2003, 12:58 AM
Hello everyone,

I am trying to fiddle around with the date functions of php a bit, and I am a bit confused by all the terminology in the docs (local time, unix timestamps and so forth), and till now, I am only producing weird errors. All I want, is some code to get the day at the place the user accesses the webpage, and 'correctly' add or remove a day. I think there should be an easier way than for me to check every little thing, from January 1st to Feb 29.

Could somebody show me the light?

TiA..

Oops.. sorry moderators :S I could have sworn I was in the PHP forum... This will teach me to browse CF with 2 windows at a time ;)

Nightfire
08-18-2003, 01:16 AM
I take it you didn't look at the manual (http://php.net/date)?

<?php
$tomorrow = mktime (0,0,0,date("m") ,date("d")+1,date("Y"));
$lastmonth = mktime (0,0,0,date("m")-1,date("d"), date("Y"));
$nextyear = mktime (0,0,0,date("m"), date("d"), date("Y")+1);
?>

doggo18
08-18-2003, 01:20 AM
Actually, I did look.. but as I said, I was kind of overwhelmed by the amount of terms, as I never really had to deal with the timezone part of it :)

Thanks alot :)