• 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

How do I get friend list from Friends table with counts of friends of my friends

WooCommerce - unset "<product> removed notice…" on cart page

Applying programmatically a coupon to an Order in WooCommerce3

Display a product custom field only in WooCommerce Admin single orders

how to make my own auto increment in php?

ORA-12546: TNS:permission denied error connection to remote oracle server

Symfony redirect if already loggedin from login page

how to fix Service provider class not found when using repository?

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

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

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

PHP 8 - libxml_disable_entity_loader() has been deprecated. How do I replace the functionality it provides?

PHP Slim Framework request using withAttribute error

Change the alert text on add to cart action without selected variation in Woocommerce

Add rows to Single product Additional information table in WooCommerce 3.6

About Contact Privacy policy Terms and conditions