You are here:  » Date and Time


Date and Time

Submitted by technoarenasol on Fri, 2012-11-23 12:53 in

HI David

Can you tell me which country time and date set on this script?...Can be possible to SET other country time and Date??

Thnx
Amin

Submitted by support on Fri, 2012-11-23 13:34

Hi Amin,

Every instance of date/time in the script is derived from PHP's time() function which returns the local time with reference to any timezone configured on the server. If you are not seeing your local time then it is possible that your server's timezone is set to GMT/UTC or the timezone of your hosting company if it is in a different country.

It would be straight forward to apply an offset to the displayed feed modified / updated / imported times on the /admin/ home page if that would be of assistance but ideally it should be corrected at the server level if not configured correctly.

If you would like to apply an offset to the times shown on /admin/, can you do a controlled test (e.g. import your smallest feed) and then let me know:

1) Your local time
2) Time shown in the Imported column

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Fri, 2012-11-23 14:18

technoarenasol

Yes David,I am use Godaddy USA Server So I Want Offset time.

My local time - 19:14
Feed imported time - 07:14

Thanx
Amin

Submitted by support on Fri, 2012-11-23 15:10

Hi Amin,

So you're 12 hours ahead of your server's timezone - edit admin/index.php and look for the following code at line 14:

  return @date("Y-m-d H:i:s",$time);

...and REPLACE with:

  return @date("Y-m-d H:i:s",$time+(12*3600));

Cheers,
David.
--
PriceTapestry.com

Submitted by Mark Hennessy on Sun, 2014-10-12 13:26

Hi David,

It appears your first line of code is no longer in the latest version?

I have set the time on my server to my local, but PT does not appear to be displaying it.

Are you able to let me know how to code in the offset once again?!

Thanks

Submitted by support on Sun, 2014-10-12 14:02

Hi Mark,

There is now a timezone configuration variable in config.advanced.php that is used with all calls to date() since PHP now raises a warning if timezone is not specified - set at line 84:

  $config_timezone = "UTC";

...according to PHP's http://php.net/manual/en/timezones.php

Cheers,
David.
--
PriceTapestry.com

Submitted by Kari on Sat, 2014-11-01 19:56

I have a 14/06A installed on a Hostgator shared account and get this error:
Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /home4/xxxxx/public_html/us2/search.php on line 399

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home4/xxxxx/public_html/us2/search.php on line 399

I have tried all of these in config.advanced.php line 84:

$config_timezone = "America/Chicago";
$config_timezone = ("America/Chicago");
$config_timezone = "CDT";
$config_timezone = ("CDT");
$config_timezone = "UTC";
$config_timezone = ("UTC");
$config_timezone = "Europe/Helsinki";
$config_timezone = ("Europe/Helsinki");
$date_default_timezone_set("America/Chicago");
$date_default_timezone_set "America/Chicago";
$date_default_timezone_set("CDT");
$date_default_timezone_set "CDT";
$date_default_timezone_set("UTC");
$date_default_timezone_set "UTC";
$date_default_timezone_set = "Europe/Helsinki";
$date_default_timezone_set = ("Europe/Helsinki");

Import time 2014-11-01 13:50:33
Local time 2014-11-01 20:50:33

Submitted by support on Sun, 2014-11-02 10:22

Hello Kari,

The value of $config_timezone is used by the date_default_timezone_set() function in includes/common.php (included by every file in the script) so the warning should not be displayed with the default:

  $config_timezone = "UTC";

...and should also be fine with;

  $config_timezone = "America/Chicago";

(according to http://php.net/manual/en/timezones.php)

The error however - which actually stops execution, appears to be unrelated and is a parse error in search.php, so if you'd like to copy that line into a reply I'll check that out for you if still occurring. If the timezone warning is also still occurring using just the above alternatives (UTC or America/Chicago, let me know and I'll check that out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by Kari on Sun, 2014-11-02 21:11

Thanks for the great support as always :)

This is now solved.

The problem had nothing to do with a config.advanced.php line 84. It was indeed a coding error in search.php on line 399 (my mistake) and for some unknown reason the above timezone related error message was shown.