• 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

MOODLE: What does it mean to aggregate h5p assets?

Dropzone: Submit both form data and dropzone at once

Insert a DIV after the 6th product only once in WooCommerce category archives

CSV to PHP class properties

Nginx disallowing execution of PHP in uploads directory with Magento

Convert PHP array into HTML tag attributes separated by spaces

How to set a domain name with php artisan serve

Changing font color in javascript

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Attempt to read property "view" on null when sending password reset email

PHP Fatal error: Class not found - PHPUnit

How to get rid of ampersand using WP Nonce URL and WP Redirect or PHP header

Extract house numbers from address string

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

About Contact Privacy policy Terms and conditions