Rfelix
Rfelix

Reputation: 57

Error When Insert Current Time in PHP

I want to insert current date and time when i add new record. But when i theres a problem. The date was correct but the time error. This is the code:

<?php echo date('d-m-Y H:i:s A',strtotime($value['Province']['created']));?>

When i add new data at 10/03/2017 18:40 PM, Then output will be 10/03/2017 11:41 Am. The time was wrong. created is column name in table Province in database

Upvotes: 0

Views: 108

Answers (2)

ImBhavin95
ImBhavin95

Reputation: 1527

Check this

In the config/core.php file of the app folder try the following with single quotes:

// Replace with your timezone ex. ('Asia/Kolkata') or
date_default_timezone_set('Australia/Melbourne');

Upvotes: 0

floriank
floriank

Reputation: 25698

Use the TimeHelper for formatting dates in the view layer:

Give the fact that your post lacks information, I assume that your problem of the time difference is the timezone? Check the documentation as well on that, it shows how to change the timezone.

Upvotes: 1

Related Questions