Re: json date

2009-02-24 Thread Jason Morris

The JSON spec actually has no way of representing a date.

There are several possible methods (and hacks) that allow you to ship dates 
over JSON (though none 
of them are really perfect).

I would personally recommend sending dates as UTC numbers, since that way you 
don't have to hack the 
JSON encoding / decoding process to get it to work, the disadvantage being you 
loose readability of 
your data (as plain text).

Hope that helps a bit.
//J

sutarsa giri wrote:
> dear all,
> I'm trying to use php as beckend for my gwt application( actually I'm 
> not really confortable with gwt+json, but I don't have choice   ),
> There is a thing that make me confuse. there is 
> JSONString,JSONNumber,JSONObject,JSONBoolean, but why there is no built 
> in JSONDate?
> 
> did anyone know why?, i'm also try to googling about json date. but it's 
> lead me to another confusion. any pointer woud be helped
> 
> 
> thx and regards,
> Gede sutarsa
> 
> > 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: json date

2009-02-24 Thread sutarsa giri
so that's was probably the reason of that.

well, seems that i need to use string for date.Thx for your information

regards,
gede sutarsa

On Wed, Feb 25, 2009 at 2:47 PM, Jason Morris  wrote:

>
> The JSON spec actually has no way of representing a date.
>
> There are several possible methods (and hacks) that allow you to ship dates
> over JSON (though none
> of them are really perfect).
>
> I would personally recommend sending dates as UTC numbers, since that way
> you don't have to hack the
> JSON encoding / decoding process to get it to work, the disadvantage being
> you loose readability of
> your data (as plain text).
>
> Hope that helps a bit.
> //J
>
> sutarsa giri wrote:
> > dear all,
> > I'm trying to use php as beckend for my gwt application( actually I'm
> > not really confortable with gwt+json, but I don't have choice   ),
> > There is a thing that make me confuse. there is
> > JSONString,JSONNumber,JSONObject,JSONBoolean, but why there is no built
> > in JSONDate?
> >
> > did anyone know why?, i'm also try to googling about json date. but it's
> > lead me to another confusion. any pointer woud be helped
> >
> >
> > thx and regards,
> > Gede sutarsa
> >
> > >
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: json date

2009-02-24 Thread Shanthala M S
hi everybody,,how to use "search" button in smartGWT,
I have two combobox,based on that i have to search the record from other
module
please help me out,,,am new to GWT

On Wed, Feb 25, 2009 at 12:17 PM, Jason Morris  wrote:

>
> The JSON spec actually has no way of representing a date.
>
> There are several possible methods (and hacks) that allow you to ship dates
> over JSON (though none
> of them are really perfect).
>
> I would personally recommend sending dates as UTC numbers, since that way
> you don't have to hack the
> JSON encoding / decoding process to get it to work, the disadvantage being
> you loose readability of
> your data (as plain text).
>
> Hope that helps a bit.
> //J
>
> sutarsa giri wrote:
> > dear all,
> > I'm trying to use php as beckend for my gwt application( actually I'm
> > not really confortable with gwt+json, but I don't have choice   ),
> > There is a thing that make me confuse. there is
> > JSONString,JSONNumber,JSONObject,JSONBoolean, but why there is no built
> > in JSONDate?
> >
> > did anyone know why?, i'm also try to googling about json date. but it's
> > lead me to another confusion. any pointer woud be helped
> >
> >
> > thx and regards,
> > Gede sutarsa
> >
> > >
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: json date

2009-02-25 Thread Dimitrijević Ivan

You can use sql99 standard (-MM-DD hh:mm:ss) to format date as
string in php and write your parser which will convert sql99 date
String into Date object in GWT.

GWT implements Date object but without support for class
GregorianCalendar, so your date parser should use some depricated
methods.

Best regards.



On Feb 25, 8:19 am, sutarsa giri  wrote:
> so that's was probably the reason of that.
>
> well, seems that i need to use string for date.Thx for your information
>
> regards,
> gede sutarsa
>
>
>
> On Wed, Feb 25, 2009 at 2:47 PM, Jason Morris  wrote:
>
> > The JSON spec actually has no way of representing a date.
>
> > There are several possible methods (and hacks) that allow you to ship dates
> > over JSON (though none
> > of them are really perfect).
>
> > I would personally recommend sending dates as UTC numbers, since that way
> > you don't have to hack the
> > JSON encoding / decoding process to get it to work, the disadvantage being
> > you loose readability of
> > your data (as plain text).
>
> > Hope that helps a bit.
> > //J
>
> > sutarsa giri wrote:
> > > dear all,
> > > I'm trying to use php as beckend for my gwt application( actually I'm
> > > not really confortable with gwt+json, but I don't have choice   ),
> > > There is a thing that make me confuse. there is
> > > JSONString,JSONNumber,JSONObject,JSONBoolean, but why there is no built
> > > in JSONDate?
>
> > > did anyone know why?, i'm also try to googling about json date. but it's
> > > lead me to another confusion. any pointer woud be helped
>
> > > thx and regards,
> > > Gede sutarsa
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: json date

2009-02-25 Thread Lothar Kimmeringer

Dimitrijević Ivan schrieb:
> You can use sql99 standard (-MM-DD hh:mm:ss) to format date as
> string in php and write your parser which will convert sql99 date
> String into Date object in GWT.

If the web-application is accessed internationally I think the
format used with iCalendar (AFAIR) or XML is better:
-MM-ddTHH:mm:ssZ
Otherwise there might be confusions what 03:00:00 means, the
timezone of the server or the timezone of the client. Or you
define that all times have to be in UTC and you convert them
accordingly on server- and client-side.


Regards, Lothar

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: json date

2009-02-26 Thread sssmack

The answer depends on whether you want the server to format the date
or the client to.
Send it as a JSONstring for the 1st case and as a JSONNumber for the
latter.
Send it as JSONNumber if you want the client (GWT) to be able to
render the date as its local time.

On Feb 25, 3:56 am, Lothar Kimmeringer  wrote:
> Dimitrijević Ivan schrieb:
>
> > You can use sql99 standard (-MM-DD hh:mm:ss) to format date as
> > string in php and write your parser which will convert sql99 date
> > String into Date object in GWT.
>
> If the web-application is accessed internationally I think the
> format used with iCalendar (AFAIR) or XML is better:
> -MM-ddTHH:mm:ssZ
> Otherwise there might be confusions what 03:00:00 means, the
> timezone of the server or the timezone of the client. Or you
> define that all times have to be in UTC and you convert them
> accordingly on server- and client-side.
>
> Regards, Lothar
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---



Re: json date

2009-02-26 Thread Shawn Pearce
I wrote a parser to convert a JSON date string in UTC (e.g. right now its
'2009-02-26 18:38:03.0') into a java.sql.Timestamp so it can be
formatted in the user's own timezone.

The parser is here:

http://android.git.kernel.org/?p=tools/gwtjsonrpc.git;a=blob;f=src/main/java/com/google/gwtjsonrpc/client/JavaSqlTimestamp_JsonSerializer.java;hb=HEAD

Once its in a java.sql.Timestamp it can be formatted in the browser's
preferred timezone with the GWT DateTimeFormat class.


The downside to this approach is the dates from the server are all in UTC,
and the dates in the browser are in the browser's timezone.  If the date is
meant to record when someone performed some action, and that person is in
another timezone, it may be a loss of information.  Knowing that something
was written in my timezone at "6 pm" doesn't tell me that perhaps the author
is actually in Europe and it was actually more like 4 am for them.  At such
times, mistakes are much more likely (the author is probably not as alert)
and extra review might be needed.


On Thu, Feb 26, 2009 at 08:29, sssmack  wrote:

>
> The answer depends on whether you want the server to format the date
> or the client to.
> Send it as a JSONstring for the 1st case and as a JSONNumber for the
> latter.
> Send it as JSONNumber if you want the client (GWT) to be able to
> render the date as its local time.
>
> On Feb 25, 3:56 am, Lothar Kimmeringer  wrote:
> > Dimitrijević Ivan schrieb:
> >
> > > You can use sql99 standard (-MM-DD hh:mm:ss) to format date as
> > > string in php and write your parser which will convert sql99 date
> > > String into Date object in GWT.
> >
> > If the web-application is accessed internationally I think the
> > format used with iCalendar (AFAIR) or XML is better:
> > -MM-ddTHH:mm:ssZ
> > Otherwise there might be confusions what 03:00:00 means, the
> > timezone of the server or the timezone of the client. Or you
> > define that all times have to be in UTC and you convert them
> > accordingly on server- and client-side.
> >
> > Regards, Lothar
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~--~~~~--~~--~--~---