Time and Date Format with Time Zones

I am pulling the date from the API as a string in this format: yyyy-MM-dd'T'HH:mm:ss'Z'

The problem is that when I try to save it, for example, today 2015-01-23T13:42:00Zthe flags Zand Tdo not appear in the MySQL database (the date is stored as 2015-01-23 13:42:00).

I would like to keep the date type of the field i.e. I do not want to save the date in the field varchar.

I am not familiar with the date and time format, so any suggestions are welcome.

+4
source share
1 answer

First read about DATETIMEand TIMESTAMPtype in mysql docs .

Then decide which type of field to use:

  • , , MySQL , DATETIME.

  • / , UTC, TIMESTAMP.

    • , TIMESTAMP , UTC, UTC.
  • / VARCHAR.

, , , , , . , . , . , , , . , , , , .

, "1,234" - , 0x04D2 ( 0000 0100 1101 0010 ). "1234" "1,234", , . , , , . .

+8

Source: https://habr.com/ru/post/1625629/


All Articles