• 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

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure

disable two buttons after clicking another button

PHP Sorting - getting 10, 11, 12 ... 1, 20, 2 rather than 1, 10, 11, 12 ... 2, 20

Update Order custom Field value with WooCommerce REST API

Input and output values for php into the browser?

Get number of working days between two dates in PHP [duplicate]

PHP each() function replacement

Add a text next to stock quantity if it is less than 10 in Woocommerce single product

How to install PHP composer inside a docker container

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

Unable to get password for the instance created from AMI

How to increase the PHP upload limits [duplicate]

MySQL default time format UTC or GMT?

How can I format this number correctly using PHP?

About Contact Privacy policy Terms and conditions