php mysql timestamp - a few questions -
i have products table i've added new field use timestamp. i'm not sure if should bigint field or timestamp field though. what's difference , offer best performance?
i want compare current date timestamp value , if difference greater x days (meaning product no longer available) exclude product query results.
i've never used timestamps before , need kick-start understand usage, thanks.
to store time in mysql down second may choose between
- timestamp
- datetime
their relationship discussed here.
but make long story short, timestamp integer , is, if no value provided, automatically set. it's choice if want store time of last insert example. datetime has set explicitely , "optically" string of format 'yyyy-mm-dd hh:mm:ss'. mysql processes both fast, ts isn't faster b/c it's integer.
especially if want operate on time beyond <,>,= i'd recommend datetime. there lot of functions available.
Comments
Post a Comment