Re: Help! Converting timezone
"He, who travels time to time" <[email protected]> Thu, 22 Sep 2022 07:17:07 -0700 (PDT)
| Newsgroups | alt.comp.lang.php |
|---|---|
| Message-ID | <[email protected]> |
Hey... Want to talk? Call me.... My telephone number >>>>
(+372) 56330687
Bint kirjutas Kolmap=C3=A4ev, 7. jaanuar 2015 kl 03:12:14 UTC+2:
> Hello,=20
> I am tearing my hair out over trying to convert a timestamp retrieved fro=
m=20
> a mysql database into my current timezone. It seems simple and I have=20
> looked at about 10 different examples online, but they are all crashing m=
y=20
> script.=20
>=20
> For example here:=20
> http://stackoverflow.com/questions/13339086/php-timestamp-date-to-user-ti=
mez=20
> one=20
>=20
> I have this which gives me a string in Los Angeles time:=20
>=20
> $timestamp =3D strtotime($row['date']);=20
> $date =3D date('M j Y g:i A', $timestamp );=20
>=20
> Now following the example in the link I mentioned I made this one change:=
=20
>=20
> $timestamp =3D strtotime($row['date']);=20
> $timestamp->setTimezone(new DateTimeZone("UTC"));=20
> $date =3D date('M j Y g:i A', $timestamp );=20
>=20
> I know that one line is not all I need -- however, this line crashes my=
=20
> script. Does anyone know why?=20
>=20
> Thanks