• 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 loop through json response data using ajax jquery?

How to Install Composer Require doctrine/dbal

Trying to iterate over a mongodb cursor twice - failing

In PHP, which is faster: preg_split or explode?

Detect emoticons in string

Not able to access model in the controller mautic

PHP contact form configuration [duplicate]

WordPress ACFNotice: get_field() - We've detected one or more calls to retrieve ACF field values before ACF has been initialized

Laravel-fopen: failed to open stream: Permission denied

Laravel phpunit test failing authorization

Why i get wrong output for html markdown?

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

Make survey at laravel 5.4 and MySQL

wordpress function breaks wp-admin

How can I get data from PHP to Android TextView?

About Contact Privacy policy Terms and conditions