Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
1.20/5 (2 votes)
See more:
sir. i want to show my system date on a textbox and system timing on another textbox on pageload.. how can i do it ??
Posted
Comments
Bh@gyesh 19-Jun-14 2:00am    
textbox1.text = DAteTime.Now().Date();
textbox2.text = DateTime.Now().Time();

1 solution

VB
Textbox1.Text = DateTime.Now.ToShortDateString()
Textbox2.Text = DateTime.Now.ToShortTimeString()

Or use
VB
Textbox1.Text = DateTime.Now.ToString("d/M/yyyy")
Textbox2.Text = DateTime.Now.ToString("HH:mm:ss")

references
Custom Date and Time Format Strings[^]
C# DateTime Format[^]
String Format for DateTime [C#][^]
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900