日期时间为24小时格式 [英] Datetime in 24 hour format

查看:94
本文介绍了日期时间为24小时格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中输入日期的类型是datetime,我得到的日期时间的格式是2011年2月21日12:00:00 AM.如何将其转换为24小时格式.

my type for date in the database is datetime and format of the datetime i am getting is 2/21/2011 12:00:00 AM .how can i convert this into 24 hour format.

推荐答案

从评论中,我建议您可能会有误解.

From the comments I would suggest that you may have a mis-understanding.

在数据库中输入日期时间数据后,它不是存储为文本,也不存储为AM/PM或24小时,这是它自己的类型.只有当应用程序将其转换为可在屏幕上显示时,差异才会实现.这是应用程序的问题,而不是数据库的问题.

After you enter datetime data into a database, it's not stored as text, it's not stored as AM/PM or 24 hour, it's its own type. Only when an application converts it for display on screen does the difference materialise. This is an artefact of the application, not the database.

您是否能够阐明为什么这是您的问题?数据如何使用?
-您要运行任何代码吗?
-您要将其复制到Excell吗?
-您只是在荣耀中晒太阳吗?

Are you able to eloborate on why this is an issue to you? How is the data being used?
- Are you going to be running any code?
- Are you copying it to Excell?
- Are you just basking in it's glory?

这篇关于日期时间为24小时格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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