Hi,
Conversion is a Java question, not related to Android though.

Anyways, here is a catch --- in Java, the date is ALWAYS stored as UTC
in "Date" object. You CANNOT convert its timezone (stored value will
be always in UTC).
However, you can print it in different timezones, that is here
formatters come in.

EXAMPLE:
//========================
        String dateStr = "8-8-2010 11:00 AM EST";
        SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy
hh:mm a zzz");
        try {
                        Date d = formatter.parse(dateStr);
                        System.out.println(d.toGMTString());

                } catch (Exception e) {
                        e.printStackTrace();
                }
//==========================


Now, System.out.println(d.toGMTString()); --- this will output:
8 Aug 2010 16:00:00 GMT
Which is correct (as I came to know that EST is GMT-5)


If you want to do some more on date and time in Java, then you better
ask in Java language related groups.


Regards
Sarwar Erfan



On Aug 10, 10:25 am, Bara <bara.kath...@gmail.com> wrote:
> Ahh, that makes a lot more sense.
>
> Now, when you say "always use UTC" (which makes more sense to me), how
> exactly would I convert a time to a different timezone?  In my
> original question I asked "How would I go about converting a string
> like "8-8-2010
> 11:00 AM EST" into the proper format for sqlite3?"  Can you provide
> some sample code or a page that would show how to do this?
>
> I come from a .NET background and usually dealing with datetime stuff
> is simple, so excuse me for asking so many questions :)
>
> Bara

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

Reply via email to