• 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

Move a child array to parent array and change parent/child name

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

Navigation idle on content download

Laravel print last executed SQL query with Query log

Laravel passport auth token not working after moving to different server

How to get variable from JavaScript to PHP [duplicate]

Where do I need to place a hook for phpunit?

How to make Canonicals with PHP

Issue with laravel eloquent model property

Last order would be re-order in wooCommerce. How is it possible?

PHP - Check if string contains words longer than 4 characters, then include "+ *", and for those shorter than 4 characters include only "*"

Add customer email and phone in "Order" column to admin orders list on Woocommerce

Target Laravelista is not instantiable

Nginx RTMP not recording

Add a text next to stock quantity if it is less than 10 in Woocommerce single product

About Contact Privacy policy Terms and conditions