Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.