Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Date/Time on Note #6

Open
jessedw44 opened this issue Feb 26, 2019 · 0 comments
Open

Incorrect Date/Time on Note #6

jessedw44 opened this issue Feb 26, 2019 · 0 comments

Comments

@jessedw44
Copy link

First off, thank you for this code. I'm using it to activate an account on a 3rd party server when a user clicks the validate link in the user email activation.... You've done all the hard work and saved me a ton of time.

Using this in the code
'created_time' => date('Y-m-d H:i:s')
Is writing UTC or some other time into the record, which is not the correct local time.

I've fixed this in my copy of your code by adding this to the top

use FOF30\Date\Date;

and then where I need the correct time

// Get current date and time in database format
JLoader::import('joomla.utilities.date');
$now = new Date();
$now = $now->toSql();

Finally when inserting
'created_time' => $now

I believe that FOF30 is part of Joomla core, but alack it could be part of admintools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant