• 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

Creating command to backup MySql database in Laravel

500 Internal Server Error on Ajax request. Not sure the origin of the problem

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory)

301 Redirect to remove query string on homepage only

How to get unique slug to same post-title for other time too?

PHP array sort and remove duplicates by two field values

Select option menu read from database and use it's values

woocommerce_wp_select options array from product attribute terms

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

Sentry + Laravel: how to log an already catched Exception?

How can i hide dt if dd got empty value

Custom add to cart button URL for specific product in WooCommerce?

stay with the last 15 elements of an array [duplicate]

loop through an anchor id

About Contact Privacy policy Terms and conditions