• 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

GA4 custom event from server side, can someone tell me how i can do the following code in php?

Change the alert text on add to cart action without selected variation in Woocommerce

XML to CSV with PHP converter [problem with images grabing]

Php - Sum up the numbers in an array one by one

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

Smarty: undefined extension class 'Smarty_Internal_Method_Get_Template_Vars'

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

Get sum of arrays inside array

GRPC installed successfully on ubuntu but php is looking for it in another folder

using random function but it's displaying duplicates

Split a string array into pieces

is there any way to validate a field that sometime is File(image) && sometime is String(Src of same image)

PHPUnit gives error: Target [IlluminateContractsViewFactory] is not instantiable

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

How to load Codeigniter 4 lang file into an array variable

About Contact Privacy policy Terms and conditions