• 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

Transpose multidimensional array and join values with commas

Transfer data between JavaScript and PHP through JSON

How can I make Laravel return a custom error for a JSON REST API

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

Laravel database insert with combining array and string

Laravel Nova, route not found

Live search query using JS and PHP for QA forum

Uploading video to Youtube using Youtube Data API V3 and Google API Client PHP -- getting 401 (unauthorized) message

Remove product downloads section in woocommerce email notifications

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

Form repeater send wrong data with last element in Laravel

The difference when using if statement true === something() vs something() === true [duplicate]

CodeIgniter force_download is not working

Using spatie/media-library, how to rename a collection of uploaded files?

How to add a heading in between checkout fields of WooCommerce

About Contact Privacy policy Terms and conditions