File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes Time format problem in MIDLet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Time format problem in MIDLet" Watch "Time format problem in MIDLet" New topic
Author

Time format problem in MIDLet

Nagesh Golem
Greenhorn

Joined: Dec 22, 2010
Posts: 7
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.....
Gopinath Karyadath
Ranch Hand

Joined: Oct 14, 2009
Posts: 87






ENJOY .... HAPPY CODING
Nagesh Golem
Greenhorn

Joined: Dec 22, 2010
Posts: 7
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

Joined: Oct 14, 2009
Posts: 87
Hi

Please go through this article.

http://www.odi.ch/prog/design/datetime.php
Nagesh Golem
Greenhorn

Joined: Dec 22, 2010
Posts: 7
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.....
kumar mdu
Ranch Hand

Joined: Jan 04, 2011
Posts: 59
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

Joined: Dec 22, 2010
Posts: 7
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

Joined: Jan 04, 2011
Posts: 59
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

Joined: Jan 04, 2011
Posts: 59
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

Joined: Jan 04, 2011
Posts: 59
why is not displaying in nokia 5230?
 
wood burning stoves
 
subject: Time format problem in MIDLet