Discussion Board

Results 1 to 4 of 4
  1. #1
    Super Contributor mayankkedia's Avatar
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146
    Hi All,

    Is there any way to read the date format specified on the device? I can read the locale through the system.property, but since J2ME doesn't support the locale class as such I cant read values from that, neither does it support SimpleDateFormat/DateFormat classes.

    In such cases what is the choice I have if I want to format the date in my application based on the date format the user has set in the date/calendar settings on the device?
    Cheers,
    Mayank

  2. #2
    Registered User grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    There is no standard way to know this.

    On Series 60 3rd Edition FP2 and later, you might be able to use:

    Code:
    String dateFormat = System.getProperty("com.nokia.mid.dateformat");
    String timeFormat = System.getProperty("com.nokia.mid.timeformat");
    These should use the same format as java.text.SimpleDateFormat in J2SE.

    Graham.

  3. #3
    Super Contributor mayankkedia's Avatar
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146
    Thanks for the reply as always.

    I am targetting S40 devices currently and going forward I would like to use pretty much the same codebase for non-Nokia devices as well. In such cases the solution mentioned will not work for me. Is there anything else that I can do to ensure the date shown in my application is in the format of the device?
    Cheers,
    Mayank

  4. #4
    Registered User grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    The only way is to include a date format as part of the localized text package. So, one of the strings in your text file would be "dd/mm/yyyy" or "mm/dd/yyyy" or "yyyy/mm/dd", depending on locale.

    Graham.

Similar Threads

  1. S60 - SocketConnection hangs at read() method : urgent
    By reach.shansi in forum General Development Questions
    Replies: 0
    Last Post: 2009-04-27, 16:20
  2. Replies: 2
    Last Post: 2008-10-17, 19:23
  3. Replies: 1
    Last Post: 2008-08-24, 15:22
  4. Replies: 2
    Last Post: 2007-02-06, 15:16
  5. How To read SMS and dont change its status?
    By -=DeathDealer=- in forum General Messaging
    Replies: 2
    Last Post: 2006-09-02, 07:56

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved