datetimepicker值没有达到期望值 [英] datetimepicker value not taking desired value

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

问题描述

Hello all



我在VB.NET中遇到了datetimepicker控件的问题



当我调试它的价值只需要一小时。



我有短日期格式。



为什么这个控件会这样做的任何想法?



提前致谢!

这是我的代码:



 f.desde = dtpDesde.Value。日期 
f.hasta = dtpHasta.Value。日期

解决方案

使用dateTimePicker1.Value.Date获取此DateTime值的Date部分。



请注意,如果您要解析为字符串,使用

 dateTimePicker1.Value。日期 .ToString 


使用16/03/2012 10:10:10字符串生成
,同时使用类似

 MyString =  CStr (dateTimePicker1.Value。日期

将导致MyString为16/03/2012。


Hello all

I''m having issues with the datetimepicker control in VB.NET

When i''m debugging the value it takes its only the hour.

I have short date format.

Any ideas why this control is doing this?

Thanks in advance!
Here is my code:

f.desde = dtpDesde.Value.Date
f.hasta = dtpHasta.Value.Date

解决方案

Use dateTimePicker1.Value.Date to get the Date part of this DateTime value.

Do notice though, if you mean to parse into strings, that using

dateTimePicker1.Value.Date.ToString 


will result with the "16/03/2012 10:10:10" string, while using something like

MyString = CStr(dateTimePicker1.Value.Date) 

will result in MyString being "16/03/2012".


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

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