You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@usergrid.apache.org by ja...@apps4u.com.au on 2014/10/08 08:57:15 UTC

Date time stamp

Hi Im creating a Guzzle Service Client and Descriptor for PHP as I know it better the swagger for PHP and , Im just about done but Im stuck on the date format Guzzle is like swagger for php and has a option called Filter that let you run a function of returned values so I'm trying to convert the times stamps into date time strings but they are not converting correctly , eg
 That time Stamp should return today at around 4.50pm but I getting back
string 'Mon, Apr 18, 46738 3:45 AM' (length=26)
   

	 $date = Carbon::createFromTimestampUTC('1412750864701')->toDayDateTimeString(); var_dump($date);  

 Also Im happy to share this code back in to Apache Usergrid I know there is a php SDK and swagger can work with php I think more php dev know Guzzle. 

Re: Date time stamp

Posted by ja...@apps4u.com.au.
sorry it did work Im just checking another if I div the time stamp by 1000 and turn it from float to int then it looks like php is picking up the correct date . Thank heaps for you advice and help :) :) :)


October 10 2014 4:31 PM, jasonk@apps4u.com.au wrote: 
> div by 1000 dose not work .. also Its the date that comes from the rest API it should be in a JSON
> comparable format.
> 
> October 10 2014 3:27 PM, jasonk@apps4u.com.au wrote:
> 
>> I used a web service call the the rest API I've created a Guzzle WebService client and I turn the
>> response JSON into a concrete Response Model class so I was taking the value returned and using
> php
>> Carbon date/time library to turn the timestamp into a date / time string
>> so the return timestamp was 1412750864701 that was the createdAt time stamp for a record I just
>> created but I was getting a date in April , Ive tried using UTC as the timeZone .
>> Im in Australia and the data was from a Apigee account as Ive been using that for testing so Im
>> guessing that there server are in UTC time Zone ..
>> I don't know if its a time zone issue as I get time stamp from AWS SDK and I use the same method
> to
>> turn them into date/time strings and have not had this issue.
>> 
>> October 10 2014 1:19 AM, "Nate McCall" <na...@thelastpickle.com> wrote:
>> 
>>> What timestamps are you looking at? I.e. from which REST invocations did
>>> they come?
>>> 
>>> Try dividing the value by 1000 as given the year value from the date you
>>> got, it looks like you got back MICROseconds precision where the code as
>>> expecting MILLIseconds.
>>> 
>>> Way deep down, columns timestamps in Cassandra all have microsecond
>>> precision so this may be trickling through (perhaps correctly, depending on
>>> the case).
>>> 
>>> On Wed, Oct 8, 2014 at 1:57 AM, <ja...@apps4u.com.au> wrote:
>>> 
>>>> Hi Im creating a Guzzle Service Client and Descriptor for PHP as I know it
>>>> better the swagger for PHP and , Im just about done but Im stuck on the
>>>> date format Guzzle is like swagger for php and has a option called Filter
>>>> that let you run a function of returned values so I'm trying to convert the
>>>> times stamps into date time strings but they are not converting correctly ,
>>>> eg
>>>> That time Stamp should return today at around 4.50pm but I getting back
>>>> string 'Mon, Apr 18, 46738 3:45 AM' (length=26)
>>>> 
>>>> $date =
>>>> Carbon::createFromTimestampUTC('1412750864701')->toDayDateTimeString();
>>>> var_dump($date);
>>>> 
>>>> Also Im happy to share this code back in to Apache Usergrid I know there
>>>> is a php SDK and swagger can work with php I think more php dev know
>>>> Guzzle.
>>> 
>>> -- 
>>> _______________________________
>>> 
>>> Nate McCall
>>> Austin, TX
>>> @zznate
>>> 
>>> Co-Founder & Sr. Technical Consultant
>>> Apache Cassandra Consulting
>>> http://www.thelastpickle.com

Re: Date time stamp

Posted by ja...@apps4u.com.au.
div by 1000 dose not work .. also Its the date that comes from the rest API it should be in a JSON comparable format.


October 10 2014 3:27 PM, jasonk@apps4u.com.au wrote: 
> I used a web service call the the rest API I've created a Guzzle WebService client and I turn the
> response JSON into a concrete Response Model class so I was taking the value returned and using php
> Carbon date/time library to turn the timestamp into a date / time string
> so the return timestamp was 1412750864701 that was the createdAt time stamp for a record I just
> created but I was getting a date in April , Ive tried using UTC as the timeZone .
> Im in Australia and the data was from a Apigee account as Ive been using that for testing so Im
> guessing that there server are in UTC time Zone ..
> I don't know if its a time zone issue as I get time stamp from AWS SDK and I use the same method to
> turn them into date/time strings and have not had this issue.
> 
> October 10 2014 1:19 AM, "Nate McCall" <na...@thelastpickle.com> wrote:
> 
>> What timestamps are you looking at? I.e. from which REST invocations did
>> they come?
>> 
>> Try dividing the value by 1000 as given the year value from the date you
>> got, it looks like you got back MICROseconds precision where the code as
>> expecting MILLIseconds.
>> 
>> Way deep down, columns timestamps in Cassandra all have microsecond
>> precision so this may be trickling through (perhaps correctly, depending on
>> the case).
>> 
>> On Wed, Oct 8, 2014 at 1:57 AM, <ja...@apps4u.com.au> wrote:
>> 
>>> Hi Im creating a Guzzle Service Client and Descriptor for PHP as I know it
>>> better the swagger for PHP and , Im just about done but Im stuck on the
>>> date format Guzzle is like swagger for php and has a option called Filter
>>> that let you run a function of returned values so I'm trying to convert the
>>> times stamps into date time strings but they are not converting correctly ,
>>> eg
>>> That time Stamp should return today at around 4.50pm but I getting back
>>> string 'Mon, Apr 18, 46738 3:45 AM' (length=26)
>>> 
>>> $date =
>>> Carbon::createFromTimestampUTC('1412750864701')->toDayDateTimeString();
>>> var_dump($date);
>>> 
>>> Also Im happy to share this code back in to Apache Usergrid I know there
>>> is a php SDK and swagger can work with php I think more php dev know
>>> Guzzle.
>> 
>> -- 
>> _______________________________
>> 
>> Nate McCall
>> Austin, TX
>> @zznate
>> 
>> Co-Founder & Sr. Technical Consultant
>> Apache Cassandra Consulting
>> http://www.thelastpickle.com

Re: Date time stamp

Posted by ja...@apps4u.com.au.
I used a web service call the the rest API I've created a Guzzle WebService client and I turn the response JSON into a  concrete Response Model class so I was taking the value returned and using php Carbon date/time library to turn the timestamp into a date / time string 
so the return timestamp was 1412750864701 that was the createdAt time stamp for a record  I just created but I was getting a date in April , Ive tried using UTC as the timeZone . 
Im in Australia and the data was from a Apigee account as Ive been using that for testing so Im guessing that there server are in UTC time Zone ..
I don't know if its a time zone issue as I get time stamp from AWS SDK and I use the same method to turn them into date/time strings and have not had this issue.



October 10 2014 1:19 AM, "Nate McCall" <na...@thelastpickle.com> wrote: 
> What timestamps are you looking at? I.e. from which REST invocations did
> they come?
> 
> Try dividing the value by 1000 as given the year value from the date you
> got, it looks like you got back MICROseconds precision where the code as
> expecting MILLIseconds.
> 
> Way deep down, columns timestamps in Cassandra all have microsecond
> precision so this may be trickling through (perhaps correctly, depending on
> the case).
> 
> On Wed, Oct 8, 2014 at 1:57 AM, <ja...@apps4u.com.au> wrote:
> 
>> Hi Im creating a Guzzle Service Client and Descriptor for PHP as I know it
>> better the swagger for PHP and , Im just about done but Im stuck on the
>> date format Guzzle is like swagger for php and has a option called Filter
>> that let you run a function of returned values so I'm trying to convert the
>> times stamps into date time strings but they are not converting correctly ,
>> eg
>> That time Stamp should return today at around 4.50pm but I getting back
>> string 'Mon, Apr 18, 46738 3:45 AM' (length=26)
>> 
>> $date =
>> Carbon::createFromTimestampUTC('1412750864701')->toDayDateTimeString();
>> var_dump($date);
>> 
>> Also Im happy to share this code back in to Apache Usergrid I know there
>> is a php SDK and swagger can work with php I think more php dev know
>> Guzzle.
> 
> -- 
> _______________________________
> 
> Nate McCall
> Austin, TX
> @zznate
> 
> Co-Founder & Sr. Technical Consultant
> Apache Cassandra Consulting
> http://www.thelastpickle.com

Re: Date time stamp

Posted by Nate McCall <na...@thelastpickle.com>.
What timestamps are you looking at? I.e. from which REST invocations did
they come?

Try dividing the value by 1000 as given the year value from the date you
got, it looks like you got back MICROseconds precision where the code as
expecting MILLIseconds.

Way deep down, columns timestamps in Cassandra all have microsecond
precision so this may be trickling through (perhaps correctly, depending on
the case).

On Wed, Oct 8, 2014 at 1:57 AM, <ja...@apps4u.com.au> wrote:

> Hi Im creating a Guzzle Service Client and Descriptor for PHP as I know it
> better the swagger for PHP and , Im just about done but Im stuck on the
> date format Guzzle is like swagger for php and has a option called Filter
> that let you run a function of returned values so I'm trying to convert the
> times stamps into date time strings but they are not converting correctly ,
> eg
>  That time Stamp should return today at around 4.50pm but I getting back
> string 'Mon, Apr 18, 46738 3:45 AM' (length=26)
>
>
>          $date =
> Carbon::createFromTimestampUTC('1412750864701')->toDayDateTimeString();
> var_dump($date);
>
>  Also Im happy to share this code back in to Apache Usergrid I know there
> is a php SDK and swagger can work with php I think more php dev know
> Guzzle.
>



-- 
-----------------
Nate McCall
Austin, TX
@zznate

Co-Founder & Sr. Technical Consultant
Apache Cassandra Consulting
http://www.thelastpickle.com