• 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

Undefined variable in Laravel 8 project (php 7.4)

Detect a fetch request in PHP

Google Calendar API batch request PHP

Add restriction to WooCommerce coupons by allowed user ID

How can I access an array/object?

Call to a member function fetch_field() on a non-object MySQLiDB

PHP and WebView - Cookie doesn't are the same

Laravel Passport - Not able to get token string in response?

Fatal error: Uncaught mysqli_sql_exception: Unknown database 'test' in ... (How do I fix that? Using PHP)

Creating a config file in PHP

how to use extended ASCII instead of unicode in PHP

Issue saving card for customer

500 (Internal Server Error) with Laravel & Docker [duplicate]

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

echo language construct is discouraged. (PHP)

About Contact Privacy policy Terms and conditions