Click here to Skip to main content
15,914,111 members
Home / Discussions / C#
   

C#

 
AnswerRe: Time Subtract Pin
dasblinkenlight11-May-11 4:33
dasblinkenlight11-May-11 4:33 
If it is a 24-hour clock, and the format is fixed as hh:mm, you can do it in a very simple way, without the system classes:
C#
private static int ParseTime(string s) {
    return 60*int.Parse(s.Substring(0, 2)) + int.Parse(s.Substring(3));
}
...
var diffInMinutes = ParseTime(strSystemTime) - ParseTime(strSystemTime);

If your code needs to be more robust than that, you should use DateTime to parse your strings, and then use the "-" operator to obtain their difference.
AnswerRe: Time Subtract Pin
jschell11-May-11 8:33
jschell11-May-11 8:33 
QuestionProperty Pin
messages10-May-11 19:25
messages10-May-11 19:25 
AnswerRe: Property PinPopular
Pete O'Hanlon10-May-11 20:39
mvePete O'Hanlon10-May-11 20:39 
AnswerRe: Property Pin
Luc Pattyn11-May-11 0:34
sitebuilderLuc Pattyn11-May-11 0:34 
AnswerRe: Property Pin
Joshi, Rushikesh11-May-11 2:29
professionalJoshi, Rushikesh11-May-11 2:29 
AnswerRe: Property Pin
Amarnath S12-May-11 17:55
professionalAmarnath S12-May-11 17:55 
QuestionChanging values in DataTable.. [modified] Pin
siva45510-May-11 19:20
siva45510-May-11 19:20 
AnswerRe: Changing values in DataTable.. Pin
dan!sh 10-May-11 19:22
professional dan!sh 10-May-11 19:22 
AnswerRe: Changing values in DataTable.. Pin
Hiren solanki10-May-11 21:07
Hiren solanki10-May-11 21:07 
AnswerRe: Changing values in DataTable.. Pin
Luc Pattyn11-May-11 0:44
sitebuilderLuc Pattyn11-May-11 0:44 
QuestionMSTest Pin
Subin Mavunkal10-May-11 19:14
Subin Mavunkal10-May-11 19:14 
AnswerRe: MSTest Pin
dan!sh 10-May-11 19:20
professional dan!sh 10-May-11 19:20 
GeneralRe: MSTest Pin
Subin Mavunkal10-May-11 19:25
Subin Mavunkal10-May-11 19:25 
GeneralRe: MSTest Pin
dan!sh 10-May-11 21:48
professional dan!sh 10-May-11 21:48 
AnswerRe: MSTest Pin
Dalek Dave18-May-11 12:17
professionalDalek Dave18-May-11 12:17 
QuestionAdding service to c# windows application Pin
sarang_k10-May-11 19:12
sarang_k10-May-11 19:12 
AnswerRe: Adding service to c# windows application Pin
dan!sh 10-May-11 19:20
professional dan!sh 10-May-11 19:20 
GeneralRe: Adding service to c# windows application Pin
sarang_k10-May-11 19:22
sarang_k10-May-11 19:22 
GeneralRe: Adding service to c# windows application Pin
dan!sh 10-May-11 21:54
professional dan!sh 10-May-11 21:54 
GeneralRe: Adding service to c# windows application Pin
Joshi, Rushikesh11-May-11 3:17
professionalJoshi, Rushikesh11-May-11 3:17 
QuestionDataGridView Sorting in windows Pin
siva45510-May-11 17:03
siva45510-May-11 17:03 
AnswerRe: DataGridView Sorting in windows [modified] Pin
Luc Pattyn10-May-11 17:11
sitebuilderLuc Pattyn10-May-11 17:11 
Questionget real html code from webbrowser Pin
mabrahao10-May-11 11:15
mabrahao10-May-11 11:15 
AnswerRe: get real html code from webbrowser Pin
Luc Pattyn10-May-11 11:22
sitebuilderLuc Pattyn10-May-11 11:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.