Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7577457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:11:24+00:00 2026-05-30T17:11:24+00:00

I am getting time from server it’s like this 12:00PM-3:00PM,7:00PM-10:30PM This time in 12

  • 0

I am getting time from server it’s like this

12:00PM-3:00PM,7:00PM-10:30PM

This time in 12 Hours format. I applied some operation on this string and I separated all times. Now I have four strings like following

(aftr1=> 12:00PM  aftr2=> 3:00PM)  (evng1=> 7:00PM  evng2=> 10:30PM)

Now I want to convert them in 24 hours time, because I want to check the time which was entered by user it is between afternoon time 12:00pm to 3:00pm or in evening 7:00pm to 10.30pm.

Or any other idea how to complete this task in j2me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:11:25+00:00Added an answer on May 30, 2026 at 5:11 pm

    Easy, from 1pm until 11:59pm you add 12 hours. Then from 12:00am until 12:59m you subtract 12 hours.

    To accomplish this in J2ME use the String parsing tools as the normal Java utility SimpleDateFormat does not exist in the API.

    http://docs.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/index.html

    String date = "12:00PM";
    if (date.indexOf("PM")!=-1)//its pm
    {
        int pmindex = date.indexOf("PM");
        int separator=date.indexOf(":");
        int hour = Integer.parseInt(date.substring(0, separator));
        int minute = Integer.parseInt(date.substring(separator+1,pmindex));
        hour = hour+12;
        System.out.println("Time is: " + hour);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sending some dates from server that has it's time in gmt-6 format, but
I am getting time out from using JsonpRequestBuilder. The entry point code goes like
I am getting this error from time to time with serialization and I don't
I m getting Time data in this format in an JSON Object. created_time: 2012-04-01T15:02:52+0000
I'm getting dates & times from various sources (e.g. file's date/time from FTP server,
I am getting some response from server side which i need to parse but
I'm getting a json from server. I can parse only one JSON at time.
13-11-2012 09:14:39 is the sample timestamp string getting from server in my app. I
I am having trouble calculating time difference. I am getting one time from web
I am getting the error Conversion failed when converting date and/or time from character

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.