如何存储数据库日期格式:24-sep-12:HH:MM:SS [英] How store database date formate: 24-sep-12:HH:MM:SS

查看:134
本文介绍了如何存储数据库日期格式:24-sep-12:HH:MM:SS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何存储数据库日期格式:24-sep-12:HH:MM:SS(系统当前日期时间)

How store database date formate: 24-sep-12:HH:MM:SS (system current date time)

推荐答案

您使用的方法错误.数据库以其自己的格式存储日期.如果要使用它,则需要将其解析为DateTime以便存储在数据库中,并使用格式化程序以这种方式显示它.

您在这里拥有所有格式选项: http://msdn.microsoft.com/zh-cn/library/8kb3ddd4.aspx [ ^ ]

根据它,您需要这样的东西:"dd-MMM-yy:hh:mm:ss".并且不要忘记使用适当的语言环境来根据需要使用月份名称.
You are taking the wrong approach. The database is storing the dates in it''s own format. If you want to use this one, you need to parse it as DateTime to store in the database and use the formatter to display it this way.

You have all the formatting options here: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx[^]

According to it you need something like this: "dd-MMM-yy:hh:mm:ss". And don''t forget to use the proper locale to have the month name as you need.


这篇关于如何存储数据库日期格式:24-sep-12:HH:MM:SS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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