• 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 properly set "0000-00-00 00:00:00" as a DateTime in PHP

phpsymfonydatetimedoctrine-orm


PHP Snippet 1:

$entEmail = new Email();
$entEmail->setViewedAt(null);

PHP Snippet 2:

$Date = date('Y-m-d H:i:s');

PHP Snippet 3:

date_default_timezone_set('America/New_York');
$date = date('Y-m-d H:i:s');

$entEmail = new Email();
$entEmail->setViewedAt( $date );

PHP Snippet 4:

date_default_timezone_set('America/New_York');

$entEmail = new Email();
$entEmail->setViewedAt( date('Y-m-d H:i:s') );

Related Snippets

how do i retrieve and display the alt text of an image in wordpress?

php echo xml documents with header

Refresh specific HTML content that retrieves data from MySQL

I need to link Google Sheet with my Laravel

Cannot retrieve error message using Symfony HttpClient if the response is not "ok"

phpseclib 2.0 can not use Composer to create autoload

Show Custom Data in Woocommerce Order Details Admin Area

Transfer data between JavaScript and PHP through JSON

PHP using str_starts_with for array to exclude same as with wildcard

Custom API and cunsuming in php?

Converting IPv6 to IPv4 address in PHP

Laravel: Why is my variable not being set while it's in the construct function of the controller?

Target class controller does not exist - Laravel 8

merge all files in directory to one text file

Is there a way to use Foundry Model for Authentification inside Functional Tests?

About Contact Privacy policy Terms and conditions