justravis Posted September 11, 2007 Share Posted September 11, 2007 I have a few columns with a Time column type. When I use UNIX_TIMESTAMP, it returns 0. Any sugestions? Thanks for yr time!!! Link to comment https://forums.phpfreaks.com/topic/68786-mysql-unix_timestamptime_col/ Share on other sites More sharing options...
fenway Posted September 11, 2007 Share Posted September 11, 2007 What? Link to comment https://forums.phpfreaks.com/topic/68786-mysql-unix_timestamptime_col/#findComment-346209 Share on other sites More sharing options...
justravis Posted September 13, 2007 Author Share Posted September 13, 2007 According to the mysql manual, "If you pass an out-of-range date to UNIX_TIMESTAMP(), it returns 0." How does a 08:40:00 time qualify as out of range? Link to comment https://forums.phpfreaks.com/topic/68786-mysql-unix_timestamptime_col/#findComment-348002 Share on other sites More sharing options...
effigy Posted September 14, 2007 Share Posted September 14, 2007 If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' UTC. date may be a DATE string, a DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD. "08:40:00" is a TIME string. Link to comment https://forums.phpfreaks.com/topic/68786-mysql-unix_timestamptime_col/#findComment-348042 Share on other sites More sharing options...
justravis Posted September 16, 2007 Author Share Posted September 16, 2007 effigy, u hav helped me before...thank you for responding... lemme ask this...ihow do most people store times in a db? not in a time type column? THANKS! Link to comment https://forums.phpfreaks.com/topic/68786-mysql-unix_timestamptime_col/#findComment-349342 Share on other sites More sharing options...
effigy Posted September 16, 2007 Share Posted September 16, 2007 I haven't had the need to store just a time. It seems useless if it's not associated with a date as well. I'm sure there's a reason... Link to comment https://forums.phpfreaks.com/topic/68786-mysql-unix_timestamptime_col/#findComment-349429 Share on other sites More sharing options...
fenway Posted September 17, 2007 Share Posted September 17, 2007 I haven't had the need to store just a time. It seems useless if it's not associated with a date as well. I'm sure there's a reason... I do this sometimes, but not very often... even so, a TIME field is always the best choice vs TIMESTAMP. Link to comment https://forums.phpfreaks.com/topic/68786-mysql-unix_timestamptime_col/#findComment-349921 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.