Jump to content

Using the DATE function.


champbronc2

Recommended Posts

OK I have a table and it has lastlogdate inserted as a VARCHAR in a format looking like such: "October 6, 2008 -3:50 PM"

 

I am trying to do this:

Select * From users where referer='' AND date LIKE %curdate%

 

But I need so that current date is in the format of Full month name, Day number (w/o zero) and year.

 

And it needs to really search in this format assuming October 6, 2008is the date : %October 6, 2008%

 

What should my line of code look like?

Link to comment
https://forums.phpfreaks.com/topic/127299-using-the-date-function/
Share on other sites

But then when I do that, the format is in a 0000-00-00 format..

 

Yeah, because you're not inserting the date properly.  In order to change it to a DATETIME now, you'd need to create a script that parses every single row and updates it to use the right column format.  Also, when inserting new rows, you'd be best off using the NOW() function in MySQL to have it automatically fill in the date and time.

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.