ABH*_*ABH 47
使用DateTimerPicker.Format财产.检查MSDN
public void SetMyCustomFormat()
{
// Set the Format type and the CustomFormat string.
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM/yyyy";
}
Run Code Online (Sandbox Code Playgroud)
Md.*_*man 12
您可以使用DateTimerPicker.Format以下属性:
DateTimerPicker.Format = DateTimePickerFormat.Custom;
DateTimerPicker.CustomFormat = "MMMM yyyy";
DateTimerPicker.ShowUpDown = true;
Run Code Online (Sandbox Code Playgroud)
注意:DateTimerPicker.ShowUpDown = true;用于使日历不可见
这将为您提供更多选项来显示具有差异格式的日期。
DateTimerPicker.Format = DateTimePickerFormat.Custom;
DateTimerPicker.CustomFormat = "MM/yyyy"; // this line gives you only the month and year.
DateTimerPicker.ShowUpDown = true;
Run Code Online (Sandbox Code Playgroud)
以下是在 Windows 应用程序 C# 的日期时间选择器控件上单独显示日期的不同格式
DateTimerPicker.CustomFormat = "MMMM yyyy";
Run Code Online (Sandbox Code Playgroud)
上面的代码将显示完整的月份名称和年份,例如“2018 年 8 月”
DateTimerPicker.CustomFormat = "MMMM yyyy";
Run Code Online (Sandbox Code Playgroud)
上面的代码将显示完整的月份名称、日期和年份,例如“08 August 2018”
DateTimerPicker.CustomFormat = "dd MM yyyy";
Run Code Online (Sandbox Code Playgroud)
此行将以指定格式给出日期,不带正斜杠“08 08 2018”
DateTimerPicker.CustomFormat = "dd/MM/yyyy";
Run Code Online (Sandbox Code Playgroud)
此行将为日期“08/08/2018”提供更具体的格式
DateTimerPicker.CustomFormat = "dd/MMM/yyyy";
Run Code Online (Sandbox Code Playgroud)
此行以“08/Aug/2018”的格式给出日期
| 归档时间: |
|
| 查看次数: |
68077 次 |
| 最近记录: |