Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax for setting time - EASY ONE 1

Status
Not open for further replies.

Tracey

Programmer
Oct 16, 2000
690
NZ
Hi

I have spent 3 hours now looking for an answer to this, a waste of time for such a small thing. I need to set a control's starttime property to be xx:00:00 AM (eg 11:00:00 AM)

the VB code in the example is this:
Schedule1.StartTime = #8:00:00 AM#

I am just starting to learn Visual Studio, and C# (chose not to go the VB way)
Could someone please tell me the correct syntax to do this in C#? I have tried allsorts and hunted the net for hours.

[cheers]

Tracey
Remember... True happiness is not getting what you want...

Its wanting what you have got!
 
I am not sure about the type of StartTime but here is an example:
Code:
DateTime dt1 = Convert.ToDateTime("8:00:00 PM");
TimeSpan ts = new TimeSpan(1,59,59);
DateTime dt2 = dt1.Add(ts);
string sdt2 = dt2.ToString("T"); // "9:59:59 PM"
-obislavu-
 
ah thank you.

Tracey
Remember... True happiness is not getting what you want...

Its wanting what you have got!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top