• 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

How to auto populate preferredCountries from intl-tel-input with db output

Undefined variable in Laravel 8 project (php 7.4)

Symfony redirect if already loggedin from login page

str_word_count() function doesn't display Arabic language properly

Failed user login on production server using Symfony framework (Authentication request could not be processed due to...)

How to KeyBy where multiple items have the same key

Error Class "LaravelFortifyFeatures" not found

Lumen - Postgresql setup - Composer

Composer fails with kylekatarnls/update-helper on new homestead

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

printing all running session variable in laravel 5.1

PHP mail function is sending blank message body

GuzzleHttp Hangs When Using Localhost

file_put_content...fail to open stream:Permission denied in Laravel 5

onKeyUp event calculation not working on the following rows from php generated forms except the first one

About Contact Privacy policy Terms and conditions