如何在vb.net中更改DateTimePicker的日期格式 [英] How to change the date format of a DateTimePicker in vb.net

查看:329
本文介绍了如何在vb.net中更改DateTimePicker的日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在vb.net中更改DateTimePicker的日期格式,以便以dd / mm / 1990格式显示日期,而没有任何时间值?我尝试将格式更改为短格式,尽管这提供了日期格式,但我要求它不能删除时间。

How can I change the date format of a DateTimePicker in vb.net so that the date is shown in the format dd/mm/1990, without any time value? I have tried changing the format to "short", and while this provides the date formatting I require it does not remove the time.

推荐答案

您需要将DateTimePicker的Format设置为Custom,然后分配CustomFormat。

You need to set the Format of the DateTimePicker to Custom and then assign the CustomFormat.

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    DateTimePicker1.Format = DateTimePickerFormat.Custom
    DateTimePicker1.CustomFormat = "dd/MM/yyyy"
End Sub

这篇关于如何在vb.net中更改DateTimePicker的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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