View Full Version : Date Function Timezone Specification date("h:i A");

09-01-2011, 06:50 AM
I'm building a script that submits the time to the databse everytime a form is submitted. Is there a way to specify one specific timezone the time each time it submits?

The format I'm using is,

date("h:i A");

09-01-2011, 01:32 PM
Set the timezone at the top of the script, and all date/time functions
will then use that timezone anywhere else in the script.

Set timezone, and the list of timezone cities to use ...

Also, if it were me, I would simple write the UNIX timestamp (integer) into the column.
That would allow you to later display it any way you wish, down to the seconds.


Which is at this value when I submitted this: 1296840028

Later, you redisplay it like this:

echo date("h:i A", $timestamp);


09-02-2011, 08:56 AM
If the variable is right_now why are you using timestamp? is that how the function is called?

09-02-2011, 01:20 PM
I just made up the variable names.

If you want to test out a snippet of code ... try this:



echo "The timestamp now is: $right_now <br />";

echo "Displaying that in a readable format: ".date("h:i A", $right_now);