Skip to main content
Known Participant
February 21, 2011
質問

php date

  • February 21, 2011
  • 返信数 1.
  • 351 ビュー

A client wants me to make a site which stores venue events in a database and seperates them between ones which are in the future or less than a month old and ones which are more than a month old

my first thoughts are this PHP function

http://php.net/manual/en/function.date.php

my PHP script will set a varable at ether todays date or todays date minus 30 days and perfrom a mysql query for all dates ether after of before that date

i guessing that i will need to format the date entirely numerically so that i can use
IF (date =< todays date) {

are operrators such as < the correct way to proceed?

このトピックへの返信は締め切られました。

返信数 1

Günter_Schenk
Inspiring
February 21, 2011

iconofsin14 wrote:

are operrators such as < the correct way to proceed?

Yes, but the correct "lower than or equal" operator would be <=.

BTW, here´s what the MySQL documentation says: "When you compare a DATE, TIME, DATETIME, or TIMESTAMP to a constant string with the <, <=, =, >=, >, or BETWEEN operators, MySQL normally converts the string to an internal long integer for faster comparison"