• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Library: "Dates and Times"

Hello Guys,

i wanne display the time in an other timezone. So tried this:
PHP Code:
        $time  Time::createFromTimestamp(1548131795'America/Chicago''en_US');
$time2 Time::createFromTimestamp(1548131795,'Europe/Berlin','de_DE');
$time2->getTimeStamp().'<br />';
$time->getTimeStamp().'<br />';
 $time2->toLocalizedString($this->currentUser['TimeFormat']).'<br />';
So what i get is this:
22.36.2019 04:36:35
22.36.2019 04:36:35

I expected to get different times. Because when i wanne make a call with someone in an other timezone... he need his "time" in his format and i need it in mine. Do I use the library wrong ?

Thanks, guys

I highly recommend using https://carbon.nesbot.com/docs/ library for dates. It's the easiest way to handle dates including timezones.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!

thx for this good tip. But shouldnt be this in the new CI 4 included? I will try your advise and comment.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.