开发者

Store timestamp value in SQL Database

开发者 https://www.devze.com 2023-02-07 11:04 出处:网络
What is actually stored in Timestamp field in the SQL? My requirement is to only store the time value like 07:00 PM

What is actually stored in Timestamp field in the SQL?

My requirement is to only store the time value like 07:00 PM

And the th开发者_如何转开发ing when I store only time value I see error message like

Incorrect datetime value: '07:00 PM' for column 'MY_TIME' at row 1

I also tried giving 07:00:00 , but it too returns same.

And when I pass entire date, it accepts.

Is there any way to only give time to timestamp field or date is required there?


Timestamp contains both date and time. For time only try TIME column type.


Timestamp is a date with time. It's the usual name for the number of seconds since 1970-01-01 00:00:00 GMT.

If you only want to store the time, you should use a column with time type (assuming you are using MySQL, may vary depending on the DB engine you use).

0

精彩评论

暂无评论...
验证码 换一张
取 消