|
|
|
ขอโค้ด Date Formatting ของ visual c# หน่อยครับ มือใหม่หัดขับสุดๆ |
|
|
|
|
|
|
|
ผมจะใส่เพิ่ม Date Formatting ตรง BirthDay ทำยังงัยดีคับ
Code (C#)
public partial class CTBCollection : Form
{
public CTBCollection()
{
InitializeComponent();
}
SqlDataAdapter dadapter;
DataSet dset;
BindingSource bsource;
string connstring = "server=(local)\\UPDATA; integrated security=sspi; database=CTBData; user id=sa; password=1234";
private void CTBCollection_Load(object sender, EventArgs e)
{
dadapter = new SqlDataAdapter("SELECT * FROM Testdata ", connstring);
dset = new DataSet();
dadapter.Fill(dset);
bsource = new BindingSource();
bsource.DataSource = dset.Tables[0];
bindingNavigator.BindingSource = this.bsource;
NameTH.DataBindings.Add(new Binding("Text", bsource, "Thainame", true));
NameEN.DataBindings.Add(new Binding("Text", bsource, "CustName", true));
Customer.DataBindings.Add(new Binding("Text", bsource, "CardNo", true));
---->> BirthDay.DataBindings.Add(new Binding("Text", bsource, "DOB", true));
Personal.DataBindings.Add(new Binding("Text", bsource, "ICNO", true));
}
}
Birthday เป็น textBox ครับ
Tag : .NET, Ms SQL Server 2008, C#, VS 2008 (.NET 3.x), Windows
|
ประวัติการแก้ไข 2013-02-18 16:13:12 2013-02-18 16:14:59 2013-02-19 15:27:09 2013-02-19 15:27:22
|
|
|
|
|
Date :
2013-02-18 16:11:57 |
By :
tening |
View :
1040 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (C#)
String.Format("{0:y yy yyy yyyy}", dt); // "8 08 008 2008" year
String.Format("{0:M MM MMM MMMM}", dt); // "3 03 Mar March" month
String.Format("{0:d dd ddd dddd}", dt); // "9 09 Sun Sunday" day
String.Format("{0:h hh H HH}", dt); // "4 04 16 16" hour 12/24
String.Format("{0:m mm}", dt); // "5 05" minute
String.Format("{0:s ss}", dt); // "7 07" second
String.Format("{0:f ff fff ffff}", dt); // "1 12 123 1230" sec.fraction
String.Format("{0:F FF FFF FFFF}", dt); // "1 12 123 123" without zeroes
String.Format("{0:t tt}", dt); // "P PM" A.M. or P.M.
String.Format("{0:z zz zzz}", dt); // "-6 -06 -06:00" time zone
http://www.csharp-examples.net/string-format-datetime/
|
|
|
|
|
Date :
2013-02-19 06:00:06 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วต้องเอาไปใช้ยังงัยหรอคับ แนะนำอีกครั้งนะคับ
|
ประวัติการแก้ไข 2013-02-20 08:42:25
|
|
|
|
Date :
2013-02-19 16:06:28 |
By :
tening |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|