BinaryNerve Tech

Friday, August 16, 2013

Timespan Use

   
string sHours = '03:00:00';
int hoursInt;
TimeSpan ts = TimeSpan.Parse(sHours);
hoursInt = ts.TotalHours;

Result:

 hoursInt = 3

Note: Can compute TotalDays, TotalMinutes, TotalSeconds, TotalMilliseconds
Posted by Sushil Shrestha at 2:54 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

About Me

My photo
Sushil Shrestha
View my complete profile

Blog Archive

  • ►  2014 (1)
    • ►  March (1)
  • ▼  2013 (12)
    • ►  September (3)
    • ▼  August (9)
      • Creating and Deploying a Simple WCF service (VS'...
      • Timespan Use     string sHours = '03:00:00'; ...
      • Converting integer hours to datetime format in M...
      • Making a New Job in MS SQL SERVER 2008 R2 Go t...
      • Table Variable (Create,Insert,Select,Update) -T...
      • Substring in Data Binding C# ASP.NET ...Default...
      • How To Make A Dynamic Table in ASP.NET (C#) ..D...
      • Handler.ashx with uploadify.js (jQuery File Uplo...
      • Basic AJAX Call ...Javascript tag <script ty...
Simple theme. Powered by Blogger.