Page 1 of 1

Error in date() code easy fix i'm most sure

Posted: Thu Jun 08, 2006 12:01 pm
by akimm

Code: Select all

<?php
// set the default timezone to use. Available since PHP 5.1
date_default_timezone_set('EDT');
$date == date(l n d y g:i a);
?>
I would like / between n/d/y i tried using // but there was still a T_STRING_ERROR on line 4 any help?

Code: Select all

[/php

Posted: Thu Jun 08, 2006 12:03 pm
by bdlang
You've forgotten to enclose the format string in quotes:

Code: Select all

$date = date('l n d y g:i a');
Plus you were using the '==' comparison operator, not the '=' assignment operator.

PHP Manual: date()
PHP Manual: operators

Ah good

Posted: Thu Jun 08, 2006 12:06 pm
by akimm
I can see clearly now, the stupidity is gone.

Thanks friend, I didn't realize it required the quotes:-)