php - Any better way to save dates in db than time()? -
i used save dates in db int(11) time()
. considering limitation of time() there better way save that?
i not use database own date type (and db own date functions).
thanks
ok, comments, understand problem using time() we're looking represent dates outside 01/01/1970 whenever/2038 range.
in case, think it's best format dates db ymdhis
, stored in bigint (or ymd
in int if time isn't needed). can use date_create("now")->format($fmt)
instead of time()
, , $fmt either 'ymd' date-only or 'ymdhis' date+time
this gives latest date somewhere in 922,337,203ad , earliest in -922,337,203bc time, or 214,748ad -214,748bc in int no time.
Comments
Post a Comment