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

  • SEARCH
  • Home
  • 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 7430133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:05:24+00:00 2026-05-29T09:05:24+00:00

in my app , I used DateField to get future time and i save

  • 0

in my app , I used DateField to get future time and i save the time as string like as 1 Feb 2012 23:49 to make a schedule for work. And I want to compare this time with time current. If time schedule = time current + 4 hour, a dialog will appear to remind working.
But compare 2 times is so difficult . Because it depend on some cases example AM or PM, or if time schedule is 2 Feb 01:00 AM and time current is 1 Feb 21:00 PM , dialog also display.

Can anybody help me compare full correctly if time schedule = time current + 4 hours ?

  • 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-29T09:05:25+00:00Added an answer on May 29, 2026 at 9:05 am

    Try this

    import net.rim.device.api.io.http.HttpDateParser;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.Dialog;
    import net.rim.device.api.ui.container.MainScreen;
    
    public class StartUp extends UiApplication {
        /**
         * Entry point for application
         */
         public static void main(String[] args) {
             StartUp start=new StartUp();
             start.enterEventDispatcher();
    
         }
        /**
         * Creates a new StartUp object
         */
        public StartUp() {
            // Push a screen onto the UI stack to have something to render before we attempt
    
            pushScreen(new DateComparision());
    
    
    
        }
        class DateComparision extends MainScreen
        {
            public DateComparision() 
            {
                String first="31 Jan 2012 23:49:01";//formate should same 
                long time1=HttpDateParser.parse(first)+(4*60*60*1000);//means after 4 hours 
                //time1= 1328068141000
                String second="1 Feb 2012 03:49:01";
                long time2=HttpDateParser.parse(second);
                //time2=1328068141000
                System.out.println(time2+"  "+time1);
                if(time2==time1){
                    displayMessage("Mached");
                }else 
                {
                    displayMessage("Not Mached");
                }
            }
        }
        public static void displayMessage(final String data){
            UiApplication.getUiApplication().invokeLater(new Runnable() {
                public void run() {
                    Dialog.inform(data);
                }
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .Net 2.0 app that is used internally and we want to
I built an android app that used the android NDK to make a shared
I had a Ruby on Rails app that used to work. I hadn't used
I used In App Purchase and i follow all step to create In App
We are porting an app which formerly used Openbase 7 to now use MySQL
I am creating a rails app and have used this code in one of
I'm building a simple accounting app to be used for personal finance. A user
I have been support a web app that is used by a user base
When used in an AIR app, some standard keystrokes in OS X are either
I used Themeroller to generate an app theme and I am using jQuery and

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.