mercredi 20 avril 2016

Use the timezone set by the user

Basically when I get the datetime column in my table I want to adjust its date and time base on the user timezone.

I have this code but it doesn't seem to work, the time never change even though I already change its timezone:

public function getCreatedAtAttribute($datetime) {
    $timezone = \Auth::user()->timezone;

    $datetime = $this->asDateTime($value);

    return $datetime->timezone($timezone);
}

Please help.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire