• 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

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

Undefined variable in Laravel 8 project (php 7.4)

Limit login attempts in Laravel 5.7

Facebook PHP SDK - will not logout properly

Laravel Unresolvable dependency resolving [Parameter #0 [ <required> $method ]] in class GuzzleHttpPsr7Request

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

Insert And Retrieve Data in MySQL with $.post Noob Question

I want to use codeigniter foreign character library in my custom PHP project how i can use it?

Composer Warning: openssl extension is missing. How to enable in WAMP

PHP if in_array() how to get the key as well?

PHP my timezone is no setting up in PHP.ini File in xampp

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

PHP password_verify

Converting array to string and then back in PHP

How to fix " Uncaught TypeError: Argument 1 passed to JpGraphException::defaultHandler() " problem in php 7.1.3 and jpgraph 4.2.6?

About Contact Privacy policy Terms and conditions