• 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

Add and update products to session cart in Laravel

How avoid Moved Permanently The document has moved here

I cannot create a auto generated date time in mysql workbench

Handling expired token in Laravel

Laravel Carbon throws error The format separator does not match

wordpress function breaks wp-admin

Ajax GET request fails in laravel 8

Combining a describing and one array with data

how to insert data into select2 search input after scan using qrcode

Server-sent events in PHP (without echo or print)

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

How to break out of a foreach once a condition is met?

How to create a individual template for page or post in custom plugin?

CSS file not imported in laravel blade view

Symfony there are no commands defined in the "make" namespace

About Contact Privacy policy Terms and conditions