Jump to content

A little help with queries and dates.


takn25

Recommended Posts

Hi, I am trying two compare to dates but have not been successful.

 

A row is filled in Mysql database called htime with  $check=mktime(17,0,0,04,10,2011);

 

My first question is  that in the mktime function I have entered 17 which is hours. I would like to know if thats like the 17th hour of the given day or thats not how it works?

 

My second question is it a valid query to use <= or >= or < in a  mysql query for example.

 

$query="SELECT * FROM hdb WHERE htime <='".time()."'";

 

Thirdly I want to know if a row is filled with mktime(17,0,0,04,10,2011);  for example How can I only extract the day from the database based on the time has passed? This is because my own query doesnt seem to be working which is the query above I have no errors but the results dont seem to be right. Any help is much appreciated thanks.

 

Link to comment
https://forums.phpfreaks.com/topic/233259-a-little-help-with-queries-and-dates/
Share on other sites

You should really do yourself a favor and store the values in MySQL's native YYYY-MM-DD HH:MM:SS format in a DATETIME field. Then you can use the date/time functions available in MySQL to perform comparisons and calculations

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.