• 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

Where do I need to place a hook for phpunit?

Laravel php artisan serve to mimic HTTPS

Issue with laravel eloquent model property

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

Laravel views are showing from cache on one server but works fine on other server

PHP: Print caught exception like Xdebug

Laravel 5 session not persisting after user is logged in

How can I make this nested location configuration use the correct path to call a php program?

Utf8 encoding issue with Laravel

PHP: How to solve ob_start() in combination imagepng() issue?

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

phpseclib 2.0 can not use Composer to create autoload

PHP Imap , php 7.4.3 on mac osx catalina

Yii2 redirecting to previous page after login

Symfony autowiring issues since docker update

About Contact Privacy policy Terms and conditions