ANIL KUMAR PANIGRAHI 's Blog

Mysql Date functions in php code

Posted by: Anil Kumar Panigrahi in: ● March 10, 2010

Hello friends,

The following query will add some times to mysql date column.

Get the today date :

$date = date(‘Y-m-d H:i:s’);

Convert it into strtotime and add which one we have to add, here i am going to add 30 minutes to existing time.

$newtime = strtotime($date . ‘ + 30 minutes’);

Covert the newtime to date format like below.

$newtime = date(‘Y-m-d H:i:s’, $newtime);

Here we will get the answer , same thing we can apply for mysql datetime column field also.

Share on Twitter

No Comments to "Mysql Date functions in php code"

Write Comment

About Me

  Anil Kumar Panigrahi
  Software Engineer (PHP)
  Blogger & Founder of Anil Labs
  Baruva, India

You can share with me . . .

My Own Contributions

1) First contribution for codeigniter framework ( multi language support using google translate API ). we can get files from http://github.com/nyros/codeigniter_multilanguage


2) Audio and Video Streaming using FFMpeg and PHP -complete doc file : http://www.docstoc.com/docs/8300349/Audio-and-Video-Streaming

Twitter Updates

Follow me @anil2u
  • http://www.google.co.uk/ logo is changing with mouse move . . . - posted on 07/09/2010 10:57:33
  • True enemies are real friends . . . - posted on 06/09/2010 10:15:29
  • Just watched nice movie " Madrasapattinam ". - posted on 05/09/2010 16:20:48
  • We will always be thankful to our teacher for all the hard work and efforts they have put in, for educating us.- Happy teachers Day . . . :) - posted on 05/09/2010 05:39:13
  • Working on shipping cost functionality (UPS and USPS) for oscommerce shopping cart - posted on 01/09/2010 09:40:03