复选框列表中的日期格式 [英] date format in checkboxlist

查看:128
本文介绍了复选框列表中的日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c#中的复选框列表框项目中设置日期格式

解决方案

如果要将其与某些数据源绑定,则需要在以下位置选择日期格式:数据选择的时间(即,如果db源是SQL,则在SQL级别对其进行格式化)


如果要显示系统日期,则表示您应该遵循以下代码,



textBox1.Text = DateTime.Now.ToShortDateString();

textBox2.Text = DateTime.Now.ToShortTimeString();





这取决于文本框或列表框。我写过用于在文本框中显示系统时间。


 textBox1.Text = DatTime.Now.ToString(   dd-MM-yyyy
02-02-2013

textBox2.Text = DatTime.Now .ToString( dd-MMM-yyyy
02-Feb-2013


how to set date format in checkbox listbox items in c#

解决方案

If you are binding it with some data source then you are required to select the date format at the time of data selection (i.e. if db source is SQL then format it at SQL level)


If you want to Display the System date means you should follow the below code,

textBox1.Text = DateTime.Now.ToShortDateString();
textBox2.Text = DateTime.Now.ToShortTimeString();


It depends on Textbox or listbox. I have written for displaying the system time in textbox.


textBox1.Text=DatTime.Now.ToString("dd-MM-yyyy")
02-02-2013

textBox2.Text=DatTime.Now.ToString("dd-MMM-yyyy")
02-Feb-2013


这篇关于复选框列表中的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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