• 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

Using spatie/media-library, how to rename a collection of uploaded files?

Split array into 4-element chunks then implode into strings

How to use PHPCBF to fix one issue at a time?

CodeIgniter extend CI_URI undefined method

How do I loop through an MS SQL database with VB.NET?

Laravel: HTML in notification

Elastic Beanstalk with Laravel Envoy

Read users and passwords from a txt file

PHP and WebView - Cookie doesn't are the same

GuzzleHttp Hangs When Using Localhost

how to sort by a custom appended relation to model

how to youtube api data to print in toolset metabox using a button click before save-post

Exact alternate to mcrypt_encrypt in PHP 7.2

get attribute from class not working php 7

Inserting Country Selection into MySQL PHP [duplicate]

About Contact Privacy policy Terms and conditions