如何从vb.net 4.0 datepicker输出中省略时间 [英] How to omit time from vb.net 4.0 datepicker output

查看:78
本文介绍了如何从vb.net 4.0 datepicker输出中省略时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个带有日期选择器的WPF项目,我似乎无法弄清楚如何从输出中消除时间戳。我只需要返回.SelectedDate。



在我的代码中我将日期转换为字符串

I am working on a WPF project with a datepicker and I can''t seem to figure out how to eliminate the time stamp from the output. I only need the .SelectedDate returned.

In my code I am converting the date to a string

if DatePicker1.ToString <> "" then



我的问题是返回的字符串是2/25/2013 12:00:00 AM

我只希望得到2/25/2013 没有时间码。

我该怎么做?


My problem is that the returned string is "2/25/2013 12:00:00 AM"
I only wish to get "2/25/2013" without the time code.
How do I do this?

推荐答案

我无法删除解决方案,但这里是一个更新我自己解决了的解决方案...

I wasn''t able to delete the solution, but here is an update "I solved it myself" solution...
If DatePicker1.ToString <> "" Then qq = Left(DatePicker1.ToString, Len(DatePicker1.ToString) - 11) : PutText("DATEIN")


使用 String.Format()或者其他东西喜欢
Me.DateTimePicker1.Value.ToString("dd/MM/yyyy")


这篇关于如何从vb.net 4.0 datepicker输出中省略时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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