CodeIgniter date - wrong time

Mateusz Ji

I'm using:

date("d-m-Y h:i:s")

in my controller, but the time is later than actual time. For example, now in my country it's 01:02, date return 20-06-2015 01:06:38.

How to fix it?

Mr. ED

Place timezone on the top of the config.php file above base_url

date_default_timezone_set('Europe/Warsaw');

Then refresh server

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

date_default_timezone_set('Europe/Warsaw');

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| If this is not set then CodeIgniter will try guess the protocol, domain
| and path to your installation. However, you should always configure this
| explicitly and never rely on auto-guessing, especially in production
| environments.
|
*/
$config['base_url'] = 'http://localhost/project/';

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

R cronjob wrong date and time

From Dev

Fullcalendar rendering the wrong time and date

From Dev

Fullcalendar rendering the wrong time and date

From Dev

JavaScript date and time displaying wrong

From Dev

Using Carbon api for date time codeigniter

From Dev

update login table field date and time in codeigniter

From Dev

CodeIgniter 3 pretty date and time format

From Dev

Calendar returns date in wrong time zone

From Dev

JSON ISO Date with seemingly wrong time zone

From Dev

f:convertDateTime returns wrong date and time

From Dev

Simple date formatting giving wrong time

From Dev

Google Calendar event created at a wrong date and time

From Dev

SimpleDateFormat Parsing Time and Date wrong minutes and seconds

From Dev

f:convertDateTime returns wrong date and time

From Dev

Formatting date with time zone. Wrong format

From Dev

PHP Date Function Gives Me A Wrong Time

From Dev

JavaScript date displaying the wrong day and time

From Dev

Microsoft Excel calculating the wrong time and date

From Dev

CodeIgniter Pagination Order By Date Results Are Ordered Wrong And Displaying Same Results

From Dev

Ruby Time#to_date() method returns wrong date

From Dev

Time UTC stamp displaying wrong Date threw PHP date function

From Dev

Ruby Time#to_date() method returns wrong date

From Dev

SimpleDateFormat giving wrong date and time after some time of deployment

From Dev

Android date, will it be wrong when going back to summer time?

From Dev

Wrong date in tooltip in charts with daylight savings time in highcharts

From Java

Google Sheet wrong date and time format for Timeline Graph

From Dev

PHP date showing wrong time despite the timestamp being correct

From Dev

Strange behavior with the strtotime function passing a wrong date and time format

From Dev

Date Object Javascript creates wrong time while using milliseconds

Related Related

  1. 1

    R cronjob wrong date and time

  2. 2

    Fullcalendar rendering the wrong time and date

  3. 3

    Fullcalendar rendering the wrong time and date

  4. 4

    JavaScript date and time displaying wrong

  5. 5

    Using Carbon api for date time codeigniter

  6. 6

    update login table field date and time in codeigniter

  7. 7

    CodeIgniter 3 pretty date and time format

  8. 8

    Calendar returns date in wrong time zone

  9. 9

    JSON ISO Date with seemingly wrong time zone

  10. 10

    f:convertDateTime returns wrong date and time

  11. 11

    Simple date formatting giving wrong time

  12. 12

    Google Calendar event created at a wrong date and time

  13. 13

    SimpleDateFormat Parsing Time and Date wrong minutes and seconds

  14. 14

    f:convertDateTime returns wrong date and time

  15. 15

    Formatting date with time zone. Wrong format

  16. 16

    PHP Date Function Gives Me A Wrong Time

  17. 17

    JavaScript date displaying the wrong day and time

  18. 18

    Microsoft Excel calculating the wrong time and date

  19. 19

    CodeIgniter Pagination Order By Date Results Are Ordered Wrong And Displaying Same Results

  20. 20

    Ruby Time#to_date() method returns wrong date

  21. 21

    Time UTC stamp displaying wrong Date threw PHP date function

  22. 22

    Ruby Time#to_date() method returns wrong date

  23. 23

    SimpleDateFormat giving wrong date and time after some time of deployment

  24. 24

    Android date, will it be wrong when going back to summer time?

  25. 25

    Wrong date in tooltip in charts with daylight savings time in highcharts

  26. 26

    Google Sheet wrong date and time format for Timeline Graph

  27. 27

    PHP date showing wrong time despite the timestamp being correct

  28. 28

    Strange behavior with the strtotime function passing a wrong date and time format

  29. 29

    Date Object Javascript creates wrong time while using milliseconds

HotTag

Archive