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
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
Share on other sites

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.