• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Time format problem in MIDLet

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

i am new to J2me. I am working for displaying time on emulator which updates every second. The current date and time is displaying on emulator, but the problem is Time is displaying in UTC format, i want to display in IST timezone.

I wrote

TimeZone tz=TimeZone.getTimeZone("IST");
Calendar cal=Calendar.getInstance(tz);
cal.setTime(new Date());
String str1=cal.get(Calendar.HOUR_OF_DAY) + ":" +cal.get(Calendar.MINUTE) + ":" + cal.get(Calendar.SECOND);

please let me know if anything wrong..and please help in ASAP with guidance or sample code.

Thank you in advance.....
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator






ENJOY .... HAPPY CODING
 
Nagesh Golem
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Gopinath,

Thank you for your reply..

Coding is too good. but may i know where i can find to setTimeZone. because this is working fine in java..but in midlet it showing me Date-Time in UTC format..

that is my problem..
even i found

calendar cal=Calendar.getInstance();
cal.setTimezone("IST");

even still i am getting in UTC only....

Please help me Gopinath.... Thank You
 
Gopinath Karyadath
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Please go through this article.

http://www.odi.ch/prog/design/datetime.php
 
Nagesh Golem
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much Gopinath.

Its really too good, actually i didn't get idea to add required time to getting time. I focused on TimeZone only...
Actually i am working on EAN13 Bar code application in J2me, may i know do you have any idea regarding that, actually i am not able to decode to digits from given EAN13 image.


can you please help me to get this.....
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to open a calendar & select date in textField in form.

Calendar calendar=Calendar.getInstance();
String time = Integer.toString(calendar.get(Calendar.DAY_OF_MONTH))+":"+Integer.toString(calendar.get(Calendar.MONTH)) + ":" + Integer.toString(calendar.get(Calendar.YEAR));
static TextField txtDate = new TextField("Date :", time,15, TextField.ANY);

Its show the current date not a calendar to select the date?
How can i do this?

help me
kumar
 
Nagesh Golem
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To open Calendar and select from that you need to use DateField, then you can select a date or time from that to textfield...

DateField datein=new DateField("In Time Date",DateField.DATE,TimeZone.getTimeZone("GMT"));

Thank you....all the best
 
kumar mdu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Nagesh :-)

Its working in Emulator. but not in real device, i'm using nokia 5320.

its showing '//' in real device.

Do you know any ideas to solve this problem?
 
kumar mdu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Nagesh javascript:emoticon('');

Its working in Emulator. but not in real device, i'm using nokia 5320.

its showing '//' in real device.

Do you know any ideas to solve this problem?
 
kumar mdu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why is not displaying in nokia 5230?
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic