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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

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

Post 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
bdlang
Forum Contributor
Posts: 395
Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US

Post 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
User avatar
akimm
Forum Contributor
Posts: 460
Joined: Thu Apr 27, 2006 10:50 am
Location: Ypsilanti Michigan, formally Clipsburgh

Ah good

Post by akimm »

I can see clearly now, the stupidity is gone.

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