Jump to content

[SOLVED] What to Enter For Datetime Field


limitphp

Recommended Posts

I am building a page that will be used to add songs to my website.

It will have songName, Genre, and copyrightDate

copyright Date is a datetime field.

 

How would I enter it in a textbox?  Do I have to include the time?

 

The reason it is a datetime field is because I know how to do searches on that type of field based on dates....

Link to comment
https://forums.phpfreaks.com/topic/154234-solved-what-to-enter-for-datetime-field/
Share on other sites

First, if it is only for dates, use DATE instead of DATETIME. YOu save 4 bytes per row.

Second: MySQL's datetime format is YYYYMMDDHHMMSS, you can use just about any separators with that, for example YYYY-MM-DD HH:MM:SS

 

Third: You can actually use any format you like, provided that your script will transform it to MySQL compatible format before inserting.

First, if it is only for dates, use DATE instead of DATETIME. YOu save 4 bytes per row.

Second: MySQL's datetime format is YYYYMMDDHHMMSS, you can use just about any separators with that, for example YYYY-MM-DD HH:MM:SS

 

Third: You can actually use any format you like, provided that your script will transform it to MySQL compatible format before inserting.

 

If I change it to DATE, can i still do this:

WHERE date > NOW()-INTERVAL 7 DAY

 

 

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.