Re: PHP/MySQL date/time

by "Rossi Designs" <webmaster(at)rossidesigns.net>

 Date:  Mon, 12 Jun 2000 00:24:11 -0400
 To:  <jay_strickland(at)pobox.com>,
<hwg-languages(at)hwg.org>
 References:  pobox
  todo: View Thread, Original
Can you use the PHP date and time functions instead of MySQL ones?

<?php
$today = date("Y-m-d");//or whatever format you need
$now = time();//likewise
$query="select title, post_date, post_time from stories
where post_date <= '$today' and post_time <= '$now'
order by post_date, post_time desc";
?>

Rossi Designs
PO Box 1084
Holly Hill, FL 32125-1084
Phone : (904) 226-8979
URL : http://rossidesigns.net
----- Original Message -----
From: Jay Strickland <jay_strickland(at)pobox.com>
To: <hwg-languages(at)hwg.org>
Sent: Sunday, June 11, 2000 11:08 PM
Subject: PHP/MySQL date/time


| I'm working on a project using mysql as the backend database
| with a PHP front end.  One of the requirements is to check the
| date and time columns for a specific row to make sure that they
| are either less than or equal to the current date and time.
|
| MySQL v 3.23 supports both date() and time() functions which you can
| just compare the columns to inside your sql statement.  Does
| anyone know if something like this is possible with v 3.22 releases?
| The virtual server that I'm working on currently only supports up to
| v 3.22.32 which doesn't appear to have those functions.
|
| Is there another way to issue an sql statement that will accomplish
| the same as:
|
| select title, post_date, post_time from stories
| where post_date <= date() and post_time <= time()
| order by post_date, post_time desc
|
| That supposedly works fine (according to my book) in 3.23 but
| doesn't work at all in 3.22 which I have to test things with.
|
| TIA,
| Jay
|
| --
| Jay Strickland Jay_Strickland(at)pobox.com
| What we hope ever to do with ease, we must first learn to do with
diligence.
|
|
|

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA