Posted By: phreaks | Aug 19th @ 9:37 PM
page 1 of 1
Comments: 2 | Views: 520

This is not the results I expected - Am I totally misunderstanding something here?

 

Should (8/20/2009 12:26:45 AM - 8/19/2009 1:22:00 PM) really return a result of 4 minutes?

 

==========================================

TimeSpan spanDiff = DateTime.Now.Subtract(GetDateTimeFromSessionFolderName(sessionChildFolder.Name));

 

LogHelper.Info("Time calc = " + DateTime.Now.ToString() + " - " + GetDateTimeFromSessionFolderName(sessionChildFolder.Name).ToString());

LogHelper.Info("Diff = " + spanDiff.Minutes.ToString());

 

 

=========================================

OUTPUT

=========================================

Time calc = 8/20/2009 12:26:45 AM - 8/19/2009 1:22:00 PM
Diff = 4

Sven Groot
Sven Groot
My name has 9 letters. Coincidence? I think not...

Try TimeSpan.TotalMinutes instead. Minutes returns just the minutes component (so you have to use it in addition to Days, Hours, etc.), while TotalMinutes returns the entire timespan's duration in minutes.

page 1 of 1
Comments: 2 | Views: 520
Microsoft Communities