Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-08-2009, 02:36 PM
Senior Member
 
Join Date: Dec 2008
Posts: 164
Rep Power: 2
dswastik is on a distinguished road
Default System time problem
I have the following code to retrieve the current system time
Code:
public static String getCurrentTimeAsString() {
        Calendar cal = Calendar.getInstance();
        StringBuffer sBuf = new StringBuffer();
        int month = cal.get(Calendar.MONTH) + 1;
        sBuf.append(month);
        sBuf.append("-");
        sBuf.append(cal.get(Calendar.DATE));
        sBuf.append("-");
        sBuf.append(cal.get(Calendar.YEAR));
        sBuf.append(" ");
        sBuf.append(cal.get(Calendar.HOUR_OF_DAY));
        sBuf.append(":");
        sBuf.append(cal.get(Calendar.MINUTE));
        sBuf.append(":");
        sBuf.append(cal.get(Calendar.SECOND));

        return sBuf.toString();
    }
The code works fine on all devices except on windows mobile with Esmertec Jbed platform, where I am getting a completely wrong time.

Any help in this regard will be highly appreciated.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
setting system clocks time pks New To Java 4 05-14-2009 04:36 AM
Date n Time Display problem kapilverma32 Advanced Java 6 02-10-2009 02:53 PM
set system time @eddie.com New To Java 3 09-02-2008 04:55 PM
Time-Date problem teo.danciu New To Java 5 08-27-2008 11:01 AM
Urgent-Imp-Displaying message with respect to system time garinapavan New To Java 1 08-03-2007 03:17 PM


All times are GMT +2. The time now is 03:31 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org