ID:1597077
 
Keywords: phpdate
<?php

//...

define("DATE_CUSTOM_FORMAT", "l, F jS, Y"); //example output: Wednesday, June 11th, 2014 (today's date)

//...inside a function, the offending line:

echo line_break() . $this -> username . " has logged in! The current date is: " . date(DATE_CUSTOM_FORMAT, time());


Is there a logical reason why the date function is returning one day ahead of today? This happens with every format. I've looked around found nothing. (I actually remember getting the right output once around the time I started playing with date.)
date() returns the time in the server's local timezone.

Use date_default_timezone_set() at the top of the script, to set the timezone you would like to display the time in. time() returns a timestamp according to UTC, so it's unaffected by all this.