Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

php date

Community Beginner ,
Feb 20, 2011 Feb 20, 2011

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?

TOPICS
Server side applications
364
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 21, 2011 Feb 21, 2011
LATEST

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"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines