Answers for "minus hours from time php"

PHP
3

minus 1 year php

$year = new DateTime(date('Y-m-d')); // gets current date
$interval = new DateInterval('P1Y');
$year->sub($interval); // subtract 1 year with $interval

// var_dump($year->format('Y')); or var_dump($year->format('Y-m-d'));
Posted by: Guest on October-22-2021
0

php datetime sub minutes

$datetime = new DateTime();

//PT 'TIME' M
//PT30S -> 30 Seconds
//PT30M -> 30 Minutes
//PT30H -> 30 Hours
$datetime->sub(new DateInterval('PT12H30M'));
Posted by: Guest on May-26-2021

Browse Popular Code Answers by Language