Re: trouble trying to display google timestamp with php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 14, 2016 at 7:02 PM, dealtek@xxxxxxxxx <dealtek@xxxxxxxxx>
wrote:

> Hi all,
>
> I am getting a timestamp from google maps. when I display it in javascript
> it works but gives odd results when I try with php... Maybe there is
> something different with the google timestamp?
>
>
> regular ts:
> 1457995288
>
> google ts:
> 1457914808793 is longer
>
>
> Q: What is different about the google timestamp and how can I display it
> with php?
>
>
> ------------------------
>
>
> date_default_timezone_set("America/Los_Angeles");
>
> ---- this works fine (regular ts)
>
> $date = date_create();
> date_timestamp_set($date, 1457995288);
> echo date_format($date,"Y/m/d H:i:s");
>
> --- it shows ok = 2016/03/14 15:41:28
>
>
> ------------
>
> OK but does not work with google map timestamp (LONGER):
>
> $date2 = date_create();
> date_timestamp_set($date2, 1457914808793);
> echo date_format($date2,"Y/m/d H:i:s");
>
> -- it shows odd (google longer ts) = 48169/06/24 15:46:33
>
> -------------------
>
> with javascript this works with google timestamp
>
> var nowts = new Date(Number(value.timestamp));
>
> and shows like = Sun Mar 14 2016 17:20:08 GMT-0700 (PDT)
>
>
> --
> Thanks,
> Dave - DealTek
> dealtek@xxxxxxxxx
> [db-16]
>
>
To confirm my assumption, I did a google search "javascript timestamp to
php timestamp" and it was correct, the timestamp coming from javascript is
the micro timestamp and in PHP you are using regular timestamp.

Micro timestamp is more to the dot than a regular timestamp.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux