Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7603315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:37:41+00:00 2026-05-30T23:37:41+00:00

If you load codeigniter’s date helper, there will be the function local_to_gmt() but it

  • 0

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???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:37:42+00:00Added an answer on May 30, 2026 at 11:37 pm

    Using gm group functions in PHP like:

    • gmmktime

    When I asked the question, I didn’t know that PHP has those functions, so I’d looked up such a behavior in Codeigniter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Codeigniter, when we use $this->load('class_name') in the controller, CI will try to create
I've a little problem. In a controller i will load a function wich is
I'm trying to use the XML DOM in CodeIgniter, but I can't load the
I've written a new model for my CodeIgniter framework. I'm trying to load the
I'm now trying to create a xml-rpc server with the CodeIgniter Framework. <?php $this->load->library('xmlrpc');
You can use the URL helper in Code Igniter to load CSS and Javascript
Sorry if this is a simple question, is it possible to load codeigniter without
How do make CodeIgniter correctly load controller classes if I want to name them
how do i load all class files in a folder in codeigniter? its for
How can I load a model into another model in Codeigniter?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.