• 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

PHP, how to convert Int value to Week days

Add restriction to WooCommerce coupons by allowed user ID

Laravel MSSQL Server Connection not working

Sagepay Error The Vendor failed to provide a RedirectionURL

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

How to get company posts from LinkedIn via API?

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

unable to load your default controller on Codeigniter

PHP returning an error message and false

php retrieve specific data onclick from database in a list format

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

XSS attack still works despite htmlspecialchars() doing its work

PHPS source file - 403 Forbidden You don't have permission to access this resource

Get image type from base64 encoded src string

Where do I need to place a hook for phpunit?

About Contact Privacy policy Terms and conditions