Vinay Jeurkar
Vinay Jeurkar

Reputation: 3122

Why am i getting 6 hours of difference in time values?

I am developing a component in Joomla 1.5.x which has JomSocial component installed on it. In a certain operation, i am making two users as friends in Jomsocial system for that two rows are added in jos_community_connection table in database. While adding the rows i am using following php function to obtain time value

date('Y-m-d H:i:s');

When i check the jomsocial wall after finishing the operation it shows me that the post was made 6 hours ago. but when i send friend request and accept it using jomsocial inbuilt system, it shows me the correct elapsed time.

The database values are

created by custom codes : 2011-11-12 23:51:29  
created by jomsocial system : 2011-11-13 05:51:29

Why am i getting the wrong time value? How can i generate the right time value for above problem? please guide..

Upvotes: 0

Views: 875

Answers (2)

Homer6
Homer6

Reputation: 15159

Maybe the server time is different from your local time. Try setting it within PHP with

http://php.net/manual/en/function.date-default-timezone-set.php

date_default_timezone_set( 'America/Los_Angeles' );

Upvotes: 2

Seth
Seth

Reputation: 131

It's quite possible that Joomla is adjusting the time based on timezone settings. Are you doing the development locally or remotely? Is the creation time the same as the actual system time on the machine or is it really 6 hours off?

Check you timezone in your PHP ini file and also check you timezone info on your Joomla profile. Then check your system time. That should help you narrow to the problem down.

Upvotes: 0

Related Questions