开发者

Storing date time in mysql table

开发者 https://www.devze.com 2023-01-30 01:33 出处:网络
I am using datetime field for storing date and time in table default it stores in :12/3/2010 3:41:37` PMFormat.

I am using datetime field for storing date and time in table

default it stores in : 12/3/2010 3:41:37` PM Format.

is there a开发者_Python百科ny way to store time in 12/3/2010 15:41

I don't want to store second and waht to store hrs in 24 hr format.

Help me please in this matter.


The format in which you store it is irrelevant. It's a datetime datatype and the database sees it as such. Formatting it a certain way is a function of display. You can either format it in your SQL (which is probably messy), or via whatever programming language you're using. Most have some dateFormat() functions available to them.


I have used these functions:

left(date_format(now(),'%Y-%m-%d %T'),17)

Now it's working.

0

精彩评论

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