Jump to content


Photo

Dates in PHP


  • Please log in to reply
2 replies to this topic

#1 Mateobus

Mateobus
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 06 July 2006 - 07:24 PM

I am trying to add 7 days to a date, is there a way to do this with the date function, or in a MySQL query with a date column. 

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,016 posts

Posted 06 July 2006 - 07:38 PM

<?php
$dbdate  = '2006-07-06';

echo date ('Y-m-d', strtotime("+7 days $dbdate"));   //==> 2006-07-13

?>

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 Mateobus

Mateobus
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 06 July 2006 - 07:40 PM

thanks bro




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users