date - Difference between UNIX_TIMESTAMP and NOW() in MySQL -
i have blog users can comment. insert time @ posted comment using now() , utilize date('j m y', stored timestamp) show time @ posted.
i want know now() homecoming locatime of end user or localtime @ server. improve suited utilize unix_timestamp now() calculate localtime @ users posted comment.
the function now() generates formatted date-time string, determined time zone of mysql server.
however, improve store times using unix_timestamp(), expressed in gmt. doing makes easier format according country of visitor (e.g. using javascript).
if still want utilize datetime columns, can store times using utc_timestamp() (it formats date now() expresses in utc); should more or less work same in other aspects.
mysql date unix-timestamp
No comments:
Post a Comment