• 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

Connecting an HTML webpage to a SQL Server

Redirect to previous page with php

Message: Set sys_temp_dir in your php.ini after installed composer

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

Unable to match results of php hash_hmac() and coldfusion hmac()

CSV to PHP class properties

PDOException SQLSTATE[HY000] [2002] No such file or directory

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

Having trouble with PDO queries (Notice: Undefined index)

Eloquent insert id with sequence next value

Cannot pass null argument when using type hinting

Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs

PHP's array_map including keys

How to trim a video by 4 fragments to 4 seconds using the PHP-FFMpeg?

Laravel s3 upload file with metadata using pre-signed url

About Contact Privacy policy Terms and conditions