The api im using requires a string like this:


I can build that easy enough in codenameone, all apart from the last bit, 
for example +00:00, in UK right now its BST so it should be +01:00, so how 
would I actually produce this stirng in an automated fashion? And for some 
which works anywhere in the world ? 

Ive written this method but as you can see that bit is hardcoded so api in 
uk thinks everythign is an hour off, I could hardcode it but then it will 
need ot change when its back to normal GMT. Im just using UK as an example, 
I guess the main guestion is how do you get how many hours a time is after 
or before GMT?

private String getIsoDateString(Date now)
        //timePicker.setDate(now); // weird cn1 wont allow this
        java.util.Calendar cal = java.util.Calendar.getInstance();
        String timezone = cal.getTimeZone().getID();
       int year = cal.get(java.util.Calendar.YEAR);
       int month =cal.get(java.util.Calendar.MONTH)+1;
       int day = cal.get(java.util.Calendar.DAY_OF_MONTH);
       String yearS=year+"";
       String monthS=month+"";
       String dayS=day+"";
       if (monthS.length()==1)
       if (dayS.length()==1)
       String hoursS = cal.get(java.util.Calendar.HOUR_OF_DAY)+"";
       String minS = cal.get(java.util.Calendar.MINUTE)+"";
       String secS = cal.get(java.util.Calendar.SECOND)+"";
       if (hoursS.length()==1)
       if (minS.length()==1)
       if (secS.length()==1)
       //year month day? or yra day month?
        String dateS = 
        return dateS;

You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
Visit this group at
To view this discussion on the web visit
For more options, visit

Reply via email to