• 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

Object of class stdClass could not be converted to string error

Changing font color in javascript

Getting error: CodeIgniterDatabaseBaseResult::getResult in CodeIgniter

Autoloading classes in PHPUnit using Composer and autoload.php

How to create a video stream from a single dynamic image in PHP

How to upload mpdf file after generating to s3 bucket in php

Need to display only array value in JSON output

Shopify password update using Shopify API

Target class controller does not exist - Laravel 8

How to Generate PDF invoice to XML format using mPDF

Zig-zag scan an N x N array

Create a new line whenever an array value reaches more than 10 characters

jQuery Ajax Post with data

How to change the app environment at run time?

PHP -> Next nearest date defined by array of days in week

About Contact Privacy policy Terms and conditions