Welcome Guest, Not a member yet? Register   Sign In
Date helper functions
#1

[eluser]bazianm[/eluser]
Hi,

I am trying to work out a simple function that will take a "human" date (MySQL date, actually) and convert it from GMT to Local and from Local to GMT. The dates are stored in GMT and I have to rework them to local time zone. The local time zone is eastern.

Here's the test code I came up with:

Code:
$this->load->helper("date");
  
  $corig = '2013-06-24 04:00:08 PM';
  $cnow = human_to_unix($corig);
  $cgmt = gmt_to_local($cnow);
  $cnowhuman = unix_to_human($cnow,true);
  $cgmthuman = unix_to_human($cgmt,true);
  echo $cnow . "<br>" . $cgmt . "<BR>" . $cnowhuman . "<br>" , $cgmthuman . "<br>";

I have this in a simple controller just to get a feel for the functionality. My problem is this: The now and gmt times are the same... no conversion is made.

I checked my php settings and it is set to NY (phpinfo shows setting as America/New_York. )

Any assistance would be appreciated...

The date I entered ($corig) is intended to represent a gmt date/time.




Theme © iAndrew 2016 - Forum software by © MyBB