6/17/2012
Convert Minutes into Days in C#
public class ConvertMinutesToDHM
{
#region Fields
private Int32 daysValue;
private Int32 hoursValue;
private Int32 minutesValue;
#endregion
#region Properties
public Int32 DaysValue
{
get
{
return daysValue;
}
set
{
daysValue = value;
}
}
public Int32 HoursValue
{
get
{
return hoursValue;
}
set
{
hoursValue = value;
}
}
public Int32 MinutesValue
{
get
{
return minutesValue;
}
set
{
minutesValue = value;
}
}
#endregion
#region Methods
public String [ ] ConvertMinutesToDayHourMinutes ( Int32 ConsolidatedMinutesValue )
{
String[] DHM = new String [ 3 ];
Int32 TemporaryDaysValue;
Int32 ConsolidatedHoursValue;
Int32 TemporaryHoursValue;
Int32 TemporaryMinutesValue;
TemporaryDaysValue = ConsolidatedMinutesValue / ( 24 * 60 );
DHM [ 0 ] = TemporaryDaysValue. ToString ( );
ConsolidatedHoursValue = ( ConsolidatedMinutesValue - ( TemporaryDaysValue * 24 * 60 ) );
TemporaryHoursValue = ConsolidatedHoursValue / 60;
DHM [ 1 ] = TemporaryHoursValue. ToString ( );
TemporaryMinutesValue = ConsolidatedMinutesValue - ( TemporaryDaysValue * 24 * 60 ) - ( TemporaryHoursValue * 60 );
DHM [ 2 ] = TemporaryMinutesValue. ToString ( );
;
return DHM;
}
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment