• 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

Symfony Make:Migration : The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

How to add a heading in between checkout fields of WooCommerce

PHP array, move keys and values to new array, but mix it up

oauth-private.key does not exist or is not readable

file_put_content...fail to open stream:Permission denied in Laravel 5

How to override header set in Apache config with more specific header in a virtual host

Performance of foreach, array_map with lambda and array_map with static function

Google API Heatmap Layer exception, why?

wp_remote_get() not passing authentication

Why i get wrong output for html markdown?

PHP my timezone is no setting up in PHP.ini File in xampp

Display Link Title Instead of URL in XSL

Set quantity minimum, maximum and step at product level in Woocommerce

How to load Codeigniter 4 lang file into an array variable

Laravel Unknown Column 'updated_at'

About Contact Privacy policy Terms and conditions