• 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

Assets not referencing to public folder (Laravel)

Reading input in php from terminal

How to add a custom field to all Woocommerce attribute terms using add_action

PHP array slice from position + attempt to return fixed number of items

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

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

Twig - How to check if variable is a number / integer

PHP Array split string and Integers

How to make dot match newline characters using regular expressions

Laravel Unknown Column 'updated_at'

how to search for a file with php

Remove country code from phone number?

SMTP ERROR: MAIL FROM command failed: 530 5.7.0 Must issue a STARTTLS command first when using PHPMailer

Losing session data after POST from third party website

Ajax GET request fails in laravel 8

About Contact Privacy policy Terms and conditions