• 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

With doctrine ODM, can I embed many subdocuments in a main document?

Getting output of MS stored procedure on php call

phpseclib 2.0 can not use Composer to create autoload

GuzzleHttp Hangs When Using Localhost

how to retrieve the first and last instance of a row in pdo dataset

PHP to search within txt file and echo the whole line

XAMPP/SQLSRV: Unable to find Sqlsrv in PHPINFO(); - errors coming from connection

Symfony - "framework.test" config is not set to true

Can't remotely connect to MySQL error (13) with PHP script, connecting through CLI works

MISSING UPDATES FOR: MEDIA Drupal 9

selected value from the listbox in php

how to validate form data in codeigniter 4

Insert database rows from columns of data from associative array of indexed arrays

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

Group data in a multidimensional array based on two columns

About Contact Privacy policy Terms and conditions