If you load codeigniter's date helper, there will be the function "local_to_gmt()" but it takes no argument and only converts current server time (that is generated by time() ).
I need the function to be able to convert any other time given from user according to his local time and DST fields in database.
Or a function like human_to_unix() with 2 more parameters: dst and local time.
Does such a function exist?
I had said: local_to_gmt() takes no argument, but as the first answerer says it DOES take an argument as well. But I'm focusing on user timezone and daylight saving options.
THE 3RD UPDATE!!!
I have found a solution but according to stackoverlow's laws I couldn't answer my own question until some hours later.
Look at this function that might be the nearest solution for me until now: http://codeigniter.com/wiki/convert_to_gmt
function convert_to_gmt($time = '', $timezone = 'UTC', $dst = FALSE)
{
if ($time == '')
{
return now();
}
$time -= timezones($timezone) * 3600;
if ($dst == TRUE)
{
$time -= 3600;
}
return $time;
}
But there is still a question:
Do you believe that the $dst will work without any problem? As I understand, according to the function the $dst will ALWAYS decrease one hour. But it should be realized weather it is summer or not. It will decrease the time even if it's winter!!!
How to overcome this problem???