Reputation: 36937
I know a typical timestamp in any format readable or otherwise is always equivalent to a date time second day month year etc. However I want to be able to search by hours minutes seconds where the day month year are irrelevant. So I am trying to wrap my head around that ability and what would be the best method of storing time so I can create searches around that alone without m-d-y getting in my way.
Upvotes: 1
Views: 2598
Reputation: 6837
Try using the TIME
field type. The TIMESTAMP
field type should only be used anyway when you want MySQL
to update the field when updating the row.
Upvotes: 1
Reputation: 4111
$hour = date("H",$date);
$minute = date("i",$date);
$second = date("s",$date);
and save them on your table as hour
,minute
and second
Upvotes: 0