• 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

WordPress + Nginx on non-standard port behind AWS ELB results in broken links

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

Center point of multiple gps coordinates with php

Utf8 encoding issue with Laravel

Input and output values for php into the browser?

Populate Dynamic Dropdowns List in Codeigniter

Implode array with array of glue strings

How to validate tin and cst using PHP?

Laravel Carbon throws error The format separator does not match

How to skip cart page on woocomerce for certain products only?

Log a user out of a website when they put their computer to sleep

add_action() function in wordpress not working [duplicate]

Currently Using CodeIgniter Framework i have an Error

How to get monthly wise data in laravel

How to get result of the formula on import xlsx with maatwebsite using Laravel? I get formula and not value of the formula

About Contact Privacy policy Terms and conditions