• 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

Laravel lang slug in url

How to write PHP in XSLT

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

add_action() function in wordpress not working [duplicate]

How to average columns of data from multiple, flat arrays?

PHP array sort and remove duplicates by two field values

MISSING UPDATES FOR: MEDIA Drupal 9

What is the difference between client-side and server-side programming?

How can i hide dt if dd got empty value

Elastic Beanstalk with Laravel Envoy

WAMP Virtual Host not working

What will the best solution for this multiple optional filter?

How to create a cookie to store the timestamp of when a page is first loaded with php

PHPExcel file download using AJAX call

AJAX call fails with SyntaxError: Unexpected end of JSON input

About Contact Privacy policy Terms and conditions