• 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

Laravel-fopen: failed to open stream: Permission denied

Stop caching for PHP 5.5.3 in MAMP

OctoberCMS / Anonymous Global Scope

sort() not affecting original array while inside foreach loop

woocommerce_wp_select options array from product attribute terms

Laravel: Create morphs() relationship nullable

XML to CSV with PHP converter [problem with images grabing]

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

Display Link Title Instead of URL in XSL

Getting output of MS stored procedure on php call

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

Prestashop webservice API creating cart rules

Composer Script echo

How to get multiple values with same key from an array PHP

protect my blog content

About Contact Privacy policy Terms and conditions