• 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

Passing a boolean value from checkbox in Laravel form

Split comma separated value from table column into rows using mysql?

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

Input and output values for php into the browser?

Hide specific products from unlogged users based in product category in WooCommerce

Sagepay Error The Vendor failed to provide a RedirectionURL

Store / Website Column in Magento 2 Admin Grid - Custom Module

Sliders in Laravel

php 7 php.ini upload_max_filesize not working

Exception thrown during the rendering of a template("Parameter "id" for route "url" must match "[^/]++" ("" given) to generate a corresponding URL.")

ConstraintViolationListInterface to Exception in Symfony

Laravel eloquent update record without loading from database

PHP 8.1: strftime() is deprecated

Where do I need to place a hook for phpunit?

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

About Contact Privacy policy Terms and conditions