• 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

Edit XML in HTML form and submit to self

How to fix bootstrap multiselect search data using ajax

Prestashop webservice API creating cart rules

Custom add to cart button URL for specific product in WooCommerce?

Sentry on Symfony: how to exclude `NotFoundHttpException`

How to Make Laravel Eloquent "IN" Query?

PHP only Hit Counter?

PHP Form Not Inserting

Store / Website Column in Magento 2 Admin Grid - Custom Module

Laravel Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) on a sub query with "ROW_NUMBER() OVER PARTITION"

Hi, I am making a contact form thingy, and my php isn't working any reason why?

How to properly start Laravel 8 with Bootstrap & authentication

Issue with laravel eloquent model property

Maatwebsite Excel 3.1 : how do I skip duplicate data when imported?

PHP array stringify

About Contact Privacy policy Terms and conditions