CleanCode Perl Libraries |
Home | Perl | Java | PowerShell | C# | SQL | Index | Tools | Download | What's New |
Multi-Lingual Library | Maintainability | ||||||||||||
Perl | Java | JavaScript | Certified Class |
Testable Class |
Standalone Mode |
Diagnostic Enabled |
Time::SimpleFormat - Provides calendar-related auxiliary functions.
use Time::SimpleFormat;
print minutesToHHMM($minuteCount);
if (HHMMtoMinutes($val) > 60) ...
print secondsToMMSS($secondCount);
print secondsToClock($secondCount);
$secs = MMSStoSeconds($timeString);
print hourstoHHMM($hourCount);
if (HHMMtoHours($val) > 24) ...
print elapsed($startTime, $endTime);
print formatDateTime(time());
Perl5.005, POSIX
Default: none
Optional: minutesToHHMM, HHMMtoMinutes, secondsToMMSS, MMSStoSeconds, hoursToHHMM, HHMMtoHours, secondsToClock, formatDateTime, elapsed
This is a collection of functions used to convert times from displayable format to numbers and back again.
minutesToHHMM(minutes)
Converts minutes to canonical HH:MM format.
minutes
- integer representing a number of minutes
string displaying hours and minutes in the format HH:MM
HHMMtoMinutes(time)
Converts canonical HH:MM to minutes.
time
- string in MM:SS format
integer number of minutes
secondsToMMSS(seconds)
Converts seconds to canonical MM:SS format.
seconds
- integer representing a number of minutes
string displaying minutes and seconds in the format MM:SS
MMSStoSeconds(time)
Converts canonical MM:SS to seconds.
time
- string in MM:SS format
integer number of seconds
hoursToHHMM(hours)
Converts hours to canonical HH:MM format.
hours
- float representing a number of hours
string displaying hours and minutes in the format HH:MM
HHMMtoHours(time)
Converts canonical HH:MM to hours.
time
- string in HH:MM format
number of seconds as a floating point number
secondsToClock(seconds)
Converts seconds to canonical HH:MM:SS format.
seconds
- integer representing a number of minutes
8-character string displaying hours, minutes, and seconds in the format HH:MM:SS
formatDateTime(startTime, endTime)
Converts standard time value to a canonical output string in the format 'YYYY-MM-DD HH:MM:SS".
time
- integer representing a time in seconds since epoch
string in the format 'YYYY-MM-DD HH:MM:SS"
elapsed(startTime, endTime)
Calculates elapsed interval between the start and end times, and provides a displayable string. The result is the concatenation of the elapsed clock time (HH:MM:SS) and the number of closest units (e.g. 75 seconds, 5.32 minutes, or 12.45 hours).
startTime
- integer representing a start time in seconds
endTime
- integer representing an end time in seconds
elapsed string in the format "HH:MM:SS (units)" where units is either "seconds", "minutes", or "hours".
None
Michael Sorens
$Revision: 8 $ $Date: 2006-12-19 21:13:43 -0800 (Tue, 19 Dec 2006) $
CleanCode 0.9
Date::Calc
Hey! The above document had some coding errors, which are explained below:
=back doesn't take any parameters, but you said =back -- end of FUNCTION section
Home | Perl | Java | PowerShell | C# | SQL | Index | Tools | Download | What's New |
CleanCode Perl Libraries | Copyright © 2001-2013 Michael Sorens - Revised 2013.06.30 |