如何使SQL Server以AM / PM格式保存datetime? [英] How to make SQL Server to save datetime with AM/PM format?

查看:177
本文介绍了如何使SQL Server以AM / PM格式保存datetime?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用AM / PM将SQL Server表 datetime 列保存 datetime 。如何使SQL Server以AM / PM格式保存 datetime

I'm trying to make my SQL Server table datetime columns save datetime with AM/PM. How to make SQL Server to save datetime with AM/PM format?

现在,它保存如下所示的日期: 2012-01-23 14:47:00.000
是否可以保存 2012-01-23 02:47:00.000 PM ??

Right now it saves date like this: 2012-01-23 14:47:00.000 Is it possible to save it 2012-01-23 02:47:00.000 PM ??

或者SQL Server以这种格式保存日期和时间( 2012-01-23 14: 47:00.000 )所有的时间,我需要转换它只是在输出和输入?

Or does SQL Server save the date and time in this format (2012-01-23 14:47:00.000) all the time and I need to convert it just on output and input?

甚至可以将其保存在此格式( 2012-01-23 02:47:00.000 PM )?或者SQL Server以24小时格式保存 datetime

Is it even possible to save it in this format (2012-01-23 02:47:00.000 PM)? Or does SQL Server save datetime in 24 hour format?

感谢任何帮助。对不起语言;)

thanks indeed for any help. sorry for language. ;)

推荐答案

内部日期和时间作为一个数字存储。

Internally the date and time are stored as a number.

无论是以12或24小时制显示,都是由程序格式化显示。

Whether it's displayed in a 12 or 24 hour clock is up to the program formatting it for display.

这篇关于如何使SQL Server以AM / PM格式保存datetime?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆