• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to set time with DateTime modify?

php


PHP Snippet 1:

$periodauction = '2018-04-09T10:00:00';
$date = DateTime::createFromFormat('Y-m-d\TH:i:s', $periodauction)->modify('-1 day');
$date->setTime(18,0);
echo $date->format('Y-m-d\TH:i:s');

PHP Snippet 2:

2018-04-08T18:00:00

Related Snippets

Handling expired token in Laravel

PHP file_get_contents function

file_get_contents() without "Http" to access external URL [closed]

How to get monthly wise data in laravel

Xdebug can't connect back to Docker host

"There is no active transaction" when refreshing database in Laravel 8.0 test

Edit XML in HTML form and submit to self

Group data in a multidimensional array based on two columns

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

Not able to override collapsible.js in magento 2

PHPExcel_IOFactory::createWriter causes wrong behaviour

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'posts.post' doesn't exist

Symfony 4: "Autowire: you should configure its value explicitly."

PHP SoapClient: set a namespace without prefix

About Contact Privacy policy Terms and conditions