php: today to 2010-05-08 21:04:06, how can i divide this time length by 30 days?

from the time length

2010-01-09 21:04:06 **to** 2010-02-08 21:04:06

how can I get date + time at each 30 day interval ?

So I should get

2010-02-09 21:04:06
2010-03-09 21:04:06
2010-04-09 21:04:06
2010-05-08 21:04:06

So everyday, a script will check today's date to see if it matches one of above. If there's a match update all rows added before today.

$point1 = "2010-02-09 21:04:06"

if (date("Y-m-d h:m:s") >= $point1){

mysql_query('UPDATE table SET status='checked' WHERE lastadded < $point1');

}

Answers


Getting 30 days from today can be done quickly via strtotime().

$nextMonth = date("Y-m-d H:i:s" ,strtotime("+30 days"));

Unless you have good reason to use PHP, I would suggest using MySQL for this task as it won't rely on external logic for the query.


Need Your Help

Box-shadow CSS style not working in IE9?

css css3 internet-explorer-9

I am using this to set the box-shadow property for a couple of images on my page and it works great on Firefox and Chrome, but refuses to work on Internet Explorer 9.

Chat system with one or two ways?

vb.net chat tcpclient

I'm trying con build a simple chat client/software (whole in on executable) wich start listen from the start on the port 5900 and when a client connect to that port the chat is established.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.