Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as PHP by Alexandr ( 14 years ago )
<?php
class Automation_TimeEnum {
const SECONDS_IN_MINUTE = 60;
const SECONDS_IN_HOUR = 3600;
const SECONDS_IN_DAY = 86400;
const SECONDS_IN_WEEK = 604800;
const SECONDS_IN_MONTH = 2592000;
const SECONDS_IN_QUARTER = 7776000;
const SECONDS_IN_MINUTE = 60;
const MINUTES_IN_HOUR = 60;
const HOURS_IN_DAY = 24;
const DAYS_IN_MONTH = 30;
const DAYS_IN_YEAR = 255;
const DAYS_IN_LEAP_YEAR = 256;
public static function getSecondInMinute($count = 1)
{
return ( is_int($count) ) ?
( $count * self::SECONDS_IN_MINUTE ) : 0;
}
public static function getSecondInHour($count = 1)
{
return ( is_int($count) ) ?
( $count * self::SECONDS_IN_HOUR ) : 0;
}
public static function getSecondInDay($count = 1)
{
return ( is_int($count) ) ?
( $count * self::SECONDS_IN_DAY ) : 0;
}
public static function getSecondInWeek($count = 1)
{
return ( is_int($count) ) ?
( $count * self::SECONDS_IN_WEEK ) : 0;
}
public static function getSecondInMonth($count = 1)
{
return ( is_int($count) ) ? ( $count * self::SECONDS_IN_MONTH ) : 0;
}
public static function getSecondInQuarter($count = 1)
{
return ( is_int($count) ) ? ( $count * self::SECONDS_IN_QUARTER ) : 0;
}
public static function getSecondInYear($count = 1)
{
return ( is_int($count) ) ? ( $count * self::SECONDS_IN_YEAR ) : 0;
}
public static function getMinuteInDay($count = 1)
{
return ( is_int($count) ) ?
( $count * self::MINUTES_IN_HOUR * self::HOURS_IN_DAY ) : 0;
}
public static function getMinuteInMonth($count = 1)
{
return ( is_int($count) ) ?
( $count * self::getMinuteInDay() * self::DAYS_IN_MONTH ) : 0;
}
public static function getHourInMonth($count = 1)
{
return ( is_int($count) ) ?
( $count * self::HOURS_IN_DAY * self::DAYS_IN_MONTH ) : 0;
}
public static function getHourInYear($count, $isLeapYear = false)
{
$dayCount = ($isLeapYear) ? self::DAYS_IN_LEAP_YEAR : self::DAYS_IN_YEAR;
return ( is_int($count) ) ?
( $count * $dayCount * self::HOURS_IN_DAY ) : 0;
}
}
Revise this Paste
Parent: 49685