MySQL provides the developer with the ability to work over time in a variety of ways. There are data types for describing fields in tables. Many features are available for use in queries. Time localization and change of time zones in sessions, MySQL settings and use of operating system time are available.
Responsibility for applying data types and changing time zones lies with the developer, who must consider client time and server time. They do not always match.
Description of tables with time fields
The example describes three options for representing time. Two are of type MySQL timestamp (start_timestamp, next_timestamp), one is of type MySQL datetime (start_datetime) and the user option is a character string (work_income).
timestamp - MySQL , 8 , : : (1). - , NULL. (2) MySQL timestamp now(), start_datetime.
, , (1, ) start_timestamp . (2, ) , . next_timestamp : "0" , NULL, .
start_datetime , now(), start_datetime NULL. , - now(). .
MySQL timestamp & datetime . , :
- int mktime ( [int hour [, int minute [, int second [, ...
datetime, timestamp MySQL.
, , MySQL timestamp , , . , .
datetime , , PHP mktime() , :
$cStndDate - , -, /. , .
- . . «-». , , , .
MySQL timestamp & datetime . - , . , , , , .
In any case, the developer should be extremely careful. Time zones, localization settings and many other nuances can create a certain misunderstanding. If something when working with a date has become with NULL or zeros in all positions, you need to look, first of all, for an error in your own algorithm. MySQL, its date fields and time functions work exceptionally stably and correctly.