Jump to content

time() to getdate


otuatail

Recommended Posts

Probably a none starter this. But I store my date using the time() function in a 10 char text field. I was wondering if I could do an SQL where date is > yesterday but would need to convert the time into a usable form. Is this possible?

 

Desmond.

 

Reason why I did this is because I could not store the date in MySQL date field WITH hh:mm:ss

 

Link to comment
https://forums.phpfreaks.com/topic/158780-time-to-getdate/
Share on other sites

I was only giving an indication of the problem. I have tried storing a date.

If I have a date field and I store '2009/050/18 18:04:22'

I get it in the database as '2009/050/18

hh:mm:ss NOW missing.

 

is this ok?

 

 

CREATE TABLE users (

users_id int NOT NULL auto_increment,

name char(20),

InsertDate datetime,

PRIMARY KEY (users_id)

);

 

INSERT INTO users (name , InsertDate) VALUES ('David' , NOW() )

 

select * from users where InsertDate > '2009/05/01'

 

 

Link to comment
https://forums.phpfreaks.com/topic/158780-time-to-getdate/#findComment-837439
Share on other sites

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.