• 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

Laravel Mix Uncaught ReferenceError: $ is not defined

Woocommerce product attributes with hierarchy like categories

*** 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

Symfony 4: how to allow dynamic values for array nodes in bundle configuration?

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

PHP web3 ERC20 token function call

Assets not referencing to public folder (Laravel)

Use Python plotly chart in PHP

PHP only Hit Counter?

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

Execute only one time and then wait set period of time before executing again

How do I enable error reporting in Laravel?

Problem with fetching data from database in Laravel

How to create a video stream from a single dynamic image in PHP

PHP: set a (deep) array key from an array [closed]

About Contact Privacy policy Terms and conditions