• 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 to create tests w/Doctrine entities without persisting them (how to set id)

Navigation idle on content download

Laravel Livewire: jQuery not working in child component loaded via @if statement

Find out the name of the last script that included the current one

How to pass security cloudflare server with php curl

Limit login attempts in Laravel 5.7

TesseractOCR not working for Laravel

Xdebug can't connect back to Docker host

PHP Deprecated issue when running artisan command

Laravel lang slug in url

"There is no active transaction" when refreshing database in Laravel 8.0 test

PHP Startup: Unable to load dynamic library 'openssl' in Ubuntu

Read users and passwords from a txt file

Substitute integers and dots with regex [duplicate]

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

About Contact Privacy policy Terms and conditions