• 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

Adding multiple items to WooCommerce cart at once

PHP Get value from JSON [duplicate]

Fatal error: Array callback has to contain indices 0 and 1

What is the function of the (new Date()).getTime() in PHP?

Doctrine 2 mapping referencing unique key

Laravel after login Two factor not working

Laravel Mix Uncaught ReferenceError: $ is not defined

Laravel implode array items to new lines

How to access a var with "-" in PHP [duplicate]

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

PHP 8 - libxml_disable_entity_loader() has been deprecated. How do I replace the functionality it provides?

MySQL upgrade causing unexpected results on simple WHERE clauses

Log file is not being written in Laravel 5.5

I'm trying to use curl with php but getting this error:Could not resolve host: Bearer

Twig - How to check if variable is a number / integer

About Contact Privacy policy Terms and conditions