Thanks james.
On Sat, Feb 23, 2008 at 7:00 AM, James Keeline <[EMAIL PROTECTED]> wrote: > --- Vijayaraghavan R <[EMAIL PROTECTED] <vijayragvan%40gmail.com>> > wrote: > > > I am a newbie php user. > > > > I use PHP & MYSQL. I want to store a date field in MYSQL using PHP & > later > > do some checking for dates greater than or less than the stored date. > > > > Can someone help me on how to do this? > > > > Thanks & Regards, > > R.Vijay > > Note that the available date range for MySQL is very generous, Jan 1, 1000 > to > Dec 31, 9999. However, in a practical sense the dates which work well in > PHP > in the current operating systems ends up being between Jan 1 1970 and some > date > around 2040. If you have a lot of historical dates which are before 1970, > you > should do your date calculations and comparisons in MySQL queries. If they > are > all after 1970 then you can use either MySQL or PHP. Don't forget about > birthdates which are very likely to be before 1970 for many applications. > > Dates which are formatted as YYYY-MM-DD HH:MM:SS can be compared directly > as > strings. > > You can also use things like UnixTime to calculate the number of seconds > after > a certain important date (1 Jan 1970 for Unix/Linux/OS X). These are > expressed > as integers. > > In a MySQL query you can literally compare one date field with another > using > the > or < signs. You can also compare against a constant in the format I > described above with HH being in 24 hour time, of course. If time zones > are > important then it is best to keep everything in UTC. > > For PHP you can compare values in the above format directly as strings or > you > can convert a date to UnixTime with functions like strtotime(). > > There is a wide selection of tools to use. For us to help you better, you > need > to pose specific questions and example data. > > James > > > [Non-text portions of this message have been removed]
