• 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

PHP-Sort array based on another array?

How to properly start Laravel 8 with Bootstrap & authentication

Unable to run composer install

renameColumn migration fails for existing column with columns does not exist error

Combine multiple columns into an array as one of the key in a results set

The sum of the user's points

Implode columnar values between two arrays into a flat array of concatenated strings

Send same name multiple checkbox values via ajax

Invalid value in field "itemtype" in Google Search Console

Natural ORDER in Laravel Eloquent ORM

PHP rotate matrix counter-clockwise

insert multiple rows in a saveall in cakephp

Yii Ajax Submit button

Wordpress 'post_type_link' hides permalink

Warning: sqlite_query() expects parameter 1 to be resource, string given

About Contact Privacy policy Terms and conditions