Yeah I can do that.. but if client side time is in 12hr format then also I am getting 24hr format time.
For 24hr format time it is giving correct time. I want to save the time same as client time (client system time). How can I do this? On Apr 22, 5:32 pm, Salvador Diaz <[email protected]> wrote: > Well then pass a java.util.Date object instantiated at the client-side > through a RPC and store it. No need to format anything. > > On Apr 22, 2:10 pm, priya <[email protected]> wrote: > > > I don't want server side date time. > > I want to store client side date time as Timestamp in database. > > > On Apr 22, 4:20 pm, Salvador Diaz <[email protected]> wrote: > > > > Sorry but I'm still not understanding exactly what you're trying to > > > do. > > > > I got the part where you're saying that you want to store a timestamp > > > in a database. But is it the server-side time or client-side time ? > > > > Either way, you shouldn't need to format dates to do that, just pass > > > the java.util.Date object in your RPCs and then instantiate your > > > timestamp from the date object before storing it in the database. > > > > What are you're storing those timestamps for ? Because depending on > > > that, you might not want to trust the dates handed to you by your > > > clients and instead use the date of the actions you want to timestamp > > > in the server side of your code. > > > > On Apr 22, 12:38 pm, priya <[email protected]> wrote: > > > > > I want to send current date time as String at server side and > > > > then I am converting this String to java.sql.TimeStamp to store into > > > > database. > > > > > But I want to store the system date and time. > > > > And to format this date time at client side I want whether the system > > > > time is in 12hr or 24hr format. > > > > > According to that I am using DatTimeFormat. > > > > > Is there any other way to do this? > > > > I want to use this in my GWT application. > > > > > On Apr 22, 3:25 pm, Salvador Diaz <[email protected]> wrote: > > > > > > > So I have to know the 12hr or 24 hr format for system time to use > > > > > > the > > > > > > DateTimeFormat. > > > > > > No you don't. You decide what format you want to display and use the > > > > > corresponding pattern in the getFormat method. > > > > > > If you want to display a date in the 24h format, you have to do: > > > > > Date myDate = new Date(); > > > > > String formattedDate = DateTimeFormat.getFormat("dd/MM/yyyy > > > > > HH:mm").format(myDate); > > > > > > If you want to display it in the 12h format you do: > > > > > String formattedDate = DateTimeFormat.getFormat("dd/MM/yyyy > > > > > hh:mm").format(myDate); > > > > > > But please tell us what you're trying to do exactly, maybe I'm missing > > > > > something. > > > > > > On Apr 22, 12:15 pm, priya <[email protected]> wrote: > > > > > > > Thanks for reply.. > > > > > > I want to know the format of the time at client side whether it is > > > > > > 12hr or 24hr.. > > > > > > because I am using: > > > > > > > DateTimeFormat to format my date. > > > > > > It is given that DateTimeFormat.getFormat("dd/MM/yyyy HH:mm") > > > > > > provides > > > > > > 24 hr format and > > > > > > DateTimeFormat.getFormat("dd/MM/yyyy hh:mm") provides 12hr format. > > > > > > (Note HH and hh). > > > > > > > I am doing this at client side. > > > > > > So I have to know the 12hr or 24 hr format for system time to use > > > > > > the > > > > > > DateTimeFormat. > > > > > > > how can i get this? > > > > > > I hope u got my question.. > > > > > > > On Apr 22, 2:37 pm, Vitali Lovich <[email protected]> wrote: > > > > > > > > Not sure what your question is. Are you trying to format for > > > > > > > display? Are > > > > > > > you trying to parse input? Trying to determine something else? > > > > > > > > Formatting & parsing already done for > > > > > > > you:http://google-web-toolkit.googlecode.com/svn/javadoc/1.4/com/google/g... > > > > > > > > A hack (unless there's no better way) would be to use > > > > > > > DateTimeFormat to > > > > > > > format a date so it displays a known time like year 0, month 1, > > > > > > > day of month > > > > > > > 1, hour 23, minute 0, second 0. Then search for the number 23 in > > > > > > > the > > > > > > > formatted string - if it's there, you're on military time - > > > > > > > otherwise AM/PM. > > > > > > > > However, this obviously has downsides because it makes > > > > > > > assumptions about how > > > > > > > the locale formats the time (in particular assumes arabic numbers > > > > > > > for time > > > > > > > format). > > > > > > > > On Wed, Apr 22, 2009 at 5:12 AM, priya <[email protected]> > > > > > > > wrote: > > > > > > > > > Hi all, > > > > > > > > > In my GWT application I want to know the time format of the > > > > > > > > system > > > > > > > > time > > > > > > > > whether its 12 hr or 24hr at client side. > > > > > > > > > How can i get this? > > > > > > > > > Can anyone help me? > > > > > > > > > Its really urgent... > > > > > > > > > Thanks, > > > > > > > > Priya > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
