• 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

SQL AVG() to 2 decimals

Unable to Edit config.inc.php

PHP 8.1: strftime() is deprecated

Artisan, creating tables in database

How to pass data to all views in Laravel 5?

Prestashop webservice API creating cart rules

How to remove index.php and index from the URL using htaccess | PHP

PHP Find Array Index value in multi-line array

I cannot create a auto generated date time in mysql workbench

php: command not found Command PhaseScriptExecution failed with a nonzero exit code

How to debug in WooCommerce 3+

How do I upload a laravel project on cPanel shared hosting?

Put content of wordpress page inside div

Alert message after submitting form in PHP

How to load Codeigniter 4 lang file into an array variable

About Contact Privacy policy Terms and conditions