DateTimePicker问题 [英] DateTimePicker Issue

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

问题描述

Helloo,我有一个DTP控件.我通常会从数据库中获取datetime值为"2010-03-27 00:00:00".但是我想将日期以这种格式"27/03/2010"放入我的DTP控件中……我能够将日期设置为"27/03/2010",但是当我将其放入DTP控件中时,抛出错误. ..help me ...

Helloo, I have a DTP control. I usually fetch the datetime value as ''2010-03-27 00:00:00'' from DB. But i wanna put the date in my DTP control in this format "27/03/2010"... I able to make the date as "27/03/2010" But when i put this in DTP control..throwing error...help me...

推荐答案

好吧,您没有告诉我们您所看到的异常是什么,所以我不得不猜测正确答案.

创建一个DateTime对象,将其设置为您的日期时间,然后将DateTimePicker设置为您创建的DateTime对象.
Well, you didn''t tell us what the exception was that you''re seeing, so I have to guess at a correct answer.

Create a DateTime object, set it to your date time, and then set the DateTimePicker to the DateTime object you created.


为什么不像yyyy那样在dtp中使用自定义格式/mm/dd还是您想要的?
why not use custom format in dtp like yyyy/mm/dd or anyhow you want?


这篇关于DateTimePicker问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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