C#Winforms中的dateTime Picker [英] dateTime Picker in C# Winforms

查看:80
本文介绍了C#Winforms中的dateTime Picker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





使用datetimepicker选择日期和时间为24小时格式(yyyy-MM-dd HH:mm:ss),并将其存储在Mysql中数据库和数据库正如我所选择的那样正确显示。



但问题是,当我从数据库中选择它时,它提供12小时格式,



但我想要的就是我输入的内容。



如何解决它

任何建议.......

解决方案

不,它不是 - 它将它作为DateTime对象。您正在使用系统的默认转换将DateTime转换为字符串,使用AM / PM设置为12小时。



而不是使用默认格式化程序,您可以选择特定格式来转换数据 - 请参阅此处:格式化日期时间以显示 - 格式字符串描述 [ ^ ]


plz在MYSQL中标记这个问题



使用日期列的选择作为



  SELECT  DATE_FORMAT('  2013-02-04 19:38:12'' %Y-%m-%d%H:%m:%s' as   date  





如果你的列是'orderdate '表订单





  SELECT  DATE_FORMAT(orderdate,' %Y-%m-%d%H:%m:%s' as   date   FROM  顺序 


hi,

am using datetimepicker to select date&time as 24 hour format(yyyy-MM-dd HH:mm:ss), and am storing that in Mysql Database,and database is showing correctly as what i selected.

but the problem is when i select that from database it is giving 12 hour format,

but i want as it is , what i entered.

How to solve it
any Suggestions.......

解决方案

No, it isn't - it's giving it as a DateTime object. What is happening is that you are converting the DateTime to a string, using the default conversion for your system, which is set as 12 hour with AM / PM.

Instead of using the default formatter, you can select a specific format to convert your data - see here: Formatting a DateTime for display - format string description[^]


plz tag this question in MYSQL

use selection of date column as

SELECT DATE_FORMAT('2013-02-04 19:38:12', '%Y-%m-%d %H:%m:%s') as date



if ur column is 'orderdate' of table order


SELECT DATE_FORMAT(orderdate, '%Y-%m-%d %H:%m:%s') as date FROM order


这篇关于C#Winforms中的dateTime Picker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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