multiply decimal with strtotime

Hi,

i’m trying to multiply a time with two different values depending what weekend day it is.

e.g.

$TimeWorked = “01:00” ;
$OnSaturday = 1.5 ;
$OnSunday = 2 ;

If (Date(“w”, Time) == 6 ) {
$TimePayed = Date( “H:i:s”, (strtotime( $TimeWorked ) * $OnSaturday )) ) // Output: “01:30:00” = OK
}
If(Date("w|, Time) == 0) {
$TimePayed = Date( “H:i:s”, (strtotime( $TimeWorked ) * $OnSunday )) ) // Output: “19:31:44” = ???
}

I don’t get it. What am i doing wrong here ?
Or is there a better way to do this ?

btw. It is european time.

Thanks,
Sylvester

You cannot just multiply timestamp to decimal, you need to present your $TimeWorked in seconds, and then multiply. Becaue strototime(‘1:00’) will give you today’s date, not just 3600 seconds as you would expect.

thank you,

but the result is the same.

[php]
$secs = mktime( “01”, “00”, “00”) ;
print Date(“h:i:s”, $secs * 1.5 ) ; // result 01:30:00
print Date( “h:i:s”, $secs * 2) . “
”; // result not good !
[/php]

To double the seconds = seconds * 2 , or am i to stupied to calculate like this ?

Sponsor our Newsletter | Privacy Policy | Terms of Service