mysql - What is the best data type for DATE and TIME -


i have application saves date , time of transaction. initial database design create separate fields date date , time varchar. second option have single field datetime.

what difference of these two??

i recommend use timestamp track every change made database. shou;d use datetime datatype if want store specific value of date , time in column. if want track changes made in values recommend use timestamp. mysql docs:

the datetime type used when need values contain both date , time information. mysql retrieves , displays datetime values in 'yyyy-mm-dd hh:mm:ss' format. supported range '1000-01-01 00:00:00' '9999-12-31 23:59:59'.

...

the timestamp data type has range of '1970-01-01 00:00:01' utc '2038-01-09 03:14:07' utc. has varying properties, depending on mysql version , sql mode server running in.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -