a small amount of code, but not so much as to alter other commands

without changing php.ini or another permanent but more difficult solution
please tell me how to change

date('l jS \of F Y h:i:s A')

add more code to change to eastern standard time zone

date_default_timezone_set('America/New_York';)
works but
not my code I just want to create one command to see if code is continuously working

and
date_default_timezone_set('America/New_York';)
would alter the log file which I didnt create
LVL 1
rgb192Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Not 100% sure I understand the question, but this might be a strategy.  You can retrieve the current settings with date_default_timezone_get().  Save this value in a variable.  Then set the Eastern time zone, recover the formatted date() and store the date string in a variable.  Then set the original timezone back.
http://iconoun.com/demo/temp_rgb192.php
<?php // demo/temp_rgb192.php

/**
 * http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28663001.html
 */
error_reporting(E_ALL);

function other_date($z = 'America/New_York', $p = 'l jS \of F Y h:i:s A')
{
    $d = date_default_timezone_get();
    date_default_timezone_set($z);
    $r = date($p);
    date_default_timezone_set($d);
    return $r;
}

echo '<pre>';
echo PHP_EOL . "LOCAL: " . date('c');
echo PHP_EOL . other_date();
echo PHP_EOL . "LOCAL: " . date('c');

Open in new window

0
rgb192Author Commented:
so this function sets the local time and then sets it back to whatever time that code had previously
0
Ray PaseurCommented:
Yes, that's the idea.  I tested it quite a few times and it seemed to work correctly - never lost a second!  It could, in theory, lose a second, but it did not happen to me yet.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rgb192Author Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.