timezone - Add PDT or PST in output display in mysql -


how can add timezone display on output? when pdt, wanted pdt, , if pst automatically change pst.

this current query

select if (dayofweek( curdate() ) = 1, date_format(date_add(curdate(), interval 2 day), "%h:%i %p"), date_format(curdate(), "%h:%i %p")) 

the output of is

12:00 

it great if can output timezone , like

12:00 pdt or 12:00 pst 

mysql doesn't store time zone, datetime value have doesn't include time zone. have store time zone separately.

a little warning: if store timezone "pst" or "pdt" easy display, hard convert other time zones, "pst" isn't unique, there several different time zones abbreviation.

if need convert datetime other timezones, should store datetime utc, , store time zone it's full tz-name, "america/new_york". however, need use programming language handle this, pyhton, ruby, php, java, sql doens't have time zone support, , afaik that's true mysql well.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -