如何转换datetimepickers格式 [英] How to convert datetimepickers format

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

问题描述

我必须将datetimepickers格式更改为DD/MM/YY.
在按钮上单击.
怎么可能.
我该怎么办???
带有ASP.NET的Web应用程序

I have to change datetimepickers format to DD/MM/YY.
on button click.
how it is possible.
what should i have to do????
Web Application with ASP.NET

推荐答案

使用以下代码:
Use following code:
SELECT CONVERT(VARCHAR(8), GETDATE(), 1) AS [MM/DD/YY]




您可以使用以下代码

Hi,

You can use following code

public void SetMyCustomFormat()
{
   // Set the Format type and the CustomFormat string.
   dateTimePicker1.Format = DateTimePickerFormat.Custom;
   dateTimePicker1.CustomFormat = "MMMM dd, yyyy - dddd";
}



来源: http://msdn. microsoft.com/en-us/library/system.windows.forms.datetimepicker.format%28v=vs.90%29.aspx [



Source : http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.format%28v=vs.90%29.aspx[^]


将此代码用于dd-mm-yy....
Use This code for dd-mm-yy....
DateTime date = (DateTime.Now);


string str = string.Format("dd-MM-yyyy");
string ab = date.ToString(str);


最好的问候..
K


Best Regards..
K


这篇关于如何转换datetimepickers格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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