On Monday 31 March 2008, Zoltán Németh wrote: > VamVan írta: > > Hello All, > > > > I have a date in 2008-03-29 12:15:00 format. > > > > - How can I reduce one day from it? > > - How can I reduce one hour from it? > > - How can I add 1 hour to today's date? > > > > Thanks > > just convert it to a timestamp with strtotime() > then you can manipulate it by adding/substracting > - 86400 for a day > - 3600 for an hour > then convert back with strftime() > > http://hu.php.net/strtotime > http://hu.php.net/strftime > > greets, > Zoltán Németh Do not use ints for date/time math. There are WAAAAY too many wacky edge cases that can bite you in the butt. http://www.php.net/manual/en/function.date-create.php Use a DateTime object. You can do all sorts of manipulations to it and it will handle all the timezone, daylight savings, leap year, and similar weirdness for you. It also supports 64-bit dates internally so you can cover the entire span of human history and then some. -- Larry Garfield AIM: LOLG42 larry@xxxxxxxxxxxxxxxx ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php