• 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 mysql + create a friend request system

How should I get started using PHPUnit as a testing framework for a bunch of functions and classes I have already made?

Sentry on Symfony: how to exclude `NotFoundHttpException`

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

Make Calculator - When Button clicked the No shows in Textbox.

"Mixed content blocked" when running an HTTP AJAX operation in an HTTPS page

What will the best solution for this multiple optional filter?

Warning: sqlite_query() expects parameter 1 to be resource, string given

Increase value by 1 on button click

Calculating Median of an array in PHP

Laravel unique validation on multiple columns

PHP's array_map including keys

PHP array_filter with arguments

Warning: A non-numeric value encountered

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'posts.post' doesn't exist

About Contact Privacy policy Terms and conditions