How to compare current time with any particular time?

Hi All,
Problem:
I have a form which accept data from user but i want that user can enter data only before 4 in the evening after that no data will be accepted and user get any message. Now the problem is I want to compare the current time with 4 o clock or 16:00:00 but i dont know how to check whether the current time is greater or lesser than 4. Till now my code are like this: if(tt.equals("16:00:00")){}else{}
where tt is current time. but this is not the feasible solution for my second clause.
Any kind of help will greatly appreciate.
Thanks

One more thing:
I find timestamp class quite helpful in my case but i
dont know how to implement the before() method
of this class.
Any idea.* You wouldn't implement before(). You'd just use it. It's already implemented for you.
* before() doesn't just compare the hour of the day. It compare two date & time objects to see which one is greater--that is, it effectively looks at all the fields, not just HOUR.
* You don't need Timestamp if you're not dealing with a database.

Similar Messages

  • How to compare current date with past date

    Sample code for comparing current date with past date
    i dont want to Calender.set method to compare it.
    How can i do it?

    PLEASE stay with ONE thread:
    http://forum.java.sun.com/thread.jspa?threadID=5143991&tstart=0

  • Compare current time and date with last modified?

    Compare current time and date with last modified?
    What is the ideal way to compared the last modified from the File class with the current date and time? last modifed value from File class is a long.

    798642 wrote:
    So what do I do to compare whether the current date and time and later than the lastModified ?
    if(file.lastModified() < System.currentTimeMillis()) {
    Like that?That tests whether the last modified time is before "now"--that is if the file was not modified in the future, so, yes.

  • I want to run down how dissatisfied I currently am with Verizon Wireless

    I want to run down how dissatisfied I currently am with Verizon Wireless; this stated with the pre-order of the iPhones on Friday I like many other customers received the "ecdp" error on the web site and it took 45 minutes to actually be able to place the order.  I got the order in and had a 09/19/2014 ship date; spoke with a few Customer Service Reps in various areas such as 611, on many of the 800 numbers available, Internet Orders (including a Supervisor) and even a Social Media Service Rep all who have confirmed this ship date to be accurate. 
    Well today (09/17/2014) I check the Pre-Order Status page and my date has been changed to 10/14/2014 so I call in to speak to Internet Orders and the Rep advises me that yes my date was pushed back but no reason is supplied, I asked to speak to a Supervisor and was transferred to Howard, Operator # 2431235, who stated that yes the prior rep was accurate and that there was no reason available as to why my ship date changed.  Howard continues by stating that as per upper management, Apple reported to Verizon that no iPhone 6+'s would be available at launch for Verizon to ship and that this has been common knowledge, within the company, that the 6+'s were not shipping until 10/14/2014, and that prior Verizon employee's to include supervisors were misinforming me of my shipping date.  Howard continued to state that the reason I got the "ecdp" error was because of the company that I work for as Verizon offers a discount so the 'ecdp" error is not something Verizon is currently addressing.  Howard then tells me not to worry that with the 10/14 date is a guaranteed delivery date and not to worry, if the phones come in early the order will be filled, I at this point ask Howard to note my account with our conversation to include the fact that he stated the 10/14 was a guaranteed date, at this point he states that while he is telling me this he will not put it in writing as at that point Verizon would be obligated to meet that date at minimum and he was not willing to put his position on the line if the phone is not shipped by that date(this can be confirmed by reviewing the recording of the call as I was advised that I was on a recorded line).  I then asked to speak to his supervisor and was told his supervisor went home for the day and that he was the highest level supervisor on at this time.  When I then asked for his supervisors contact information to lodge a complaint he said that I would need to call back in on 611 from my handset as Customer Service handles complaints not supervisors. 
    I did call back and speak with a Representative on 611 who tried to assist but was not able to do much, this rep took my information and is having their supervisor call me to try addressing the way Howard handled the call however this has not occurred at the time of this writing.  I did tell this rep that I was honestly considering going to another carrier, (I have been with Verizon 7-8 years and currently have 10 lines of service on my account) I know I will not get the iPhone 6+ on launch day with another carrier which was not the driving factor but rather the way Howard dealt with the situation and the lack of respect that as a customer of Verizon I have always got from other representatives, as you know it takes one person to sour someone on a whole company, Howard even stated that if I want to go to another carrier that was fine with him.  However, the Customer Service Rep I spoke with after Howard (I wish I could remember his name) calmed me down not to leave Verizon but did agree that a complaint needed to be filed, personally I would like to file it directly with an Associate Vice President or higher but do understand that there is a “Chain of Command” that needs to be filed
    Let this be a warning to anyone who call internet sale and gets Howard, operator #2431235, I would suggest you immediately request a different supervisor that will treat you with respect.  As stated above Howard will tell you that the iPhone 6+ was not and has never been available to ship on launch day due to Apple purposely not providing enough units to meet the demand and that Verizon knew this while taking our pre-orders. 

    I feel your pain Robert. I do believe VZW and Apple knew all along the I6 Plus would not be available on 19 Sep and that it was a way to bolster new contracts, renewed contracts and apple sales stats. It's unfortunate the company wasn't more clairvoyant, most of us would have still pre-ordered but been a little less frustrated.

  • How to get current time and date??

    How to get current time and date from my PC time and date to the java application??
    i use java.util.* package but got error, that is:
    - java.util.* and java.sql.* class are match
    - abstract class cannot be instantiated
    so what can i do, pls guide...thanks...

    There is a method in the System class that will return the current system time. You could also instantiate a Date, Time, Timestamp, or Calendar object, all of which get created with the system time by default.
    Don't import *. Import the specific classes you need.
    Next time, post the actual text of the exceptions/compile errors. If you make people guess, most just won't bother.

  • Can anybody tell how to compare two documents with two pointers controlled with the same mouse

    can anybody tell how to compare two documents with two pointers controlled with the same mouse ??

    I saw what I need but in a game to find the differences between two photos (two screens, two pointers controlled by one mouse), and I need a program to make the same thing   (compare a chosen files)

  • How to concatenate single quote with any field like 'VBAK'

    Hi,
    How to concatenate single quote with any fields.
    say for example I have table name as MARA, I have to pass that table name to other fields with single quote , like I have to pass that as
    tab name = 'MARA'.
    but how to do this,
    below statement will not work
    concatenate '''  'MARA'   ''' into string.. it's giving syntax error...
    Regards,
    Mrunal

    gv_name = 'MARA'.
    gc_quote = '''.
    CONCATENATE gc_quote gv_name gc_quote INTO value.
    Pushpraj

  • When logged into Aruba Central, how do I search IAPs with a particular label?

    Q: When logged into Aruba Central, how do I search IAPs with a particular label?
    A: This is a very common request from many of the Aruba Central customers. For example, an administrator wants to quickly look at the status of all IAPs serving the guests in the campus? Or If he wants to immediately track down the IAPs only in the warehouse.
    In such cases, this feature would be really handy and helps us to give immediate glance of the required IAPs.
    How does this work ?  
    For Aruba Central, to help in such cases, one needs to first assign the access points with appropriate labels.  As we discussed above, all IAPs in the warehouse, can be labeled with a label string as  "warehouse". Similarly, an IAP in the guest lobby, can be labeled with a "lobby IAP" label.
    Aruba Central would then group these IAPs in the backend and index the seacrh, to be ready to pull up the list when you search with a particular label.
    Now, here is how you search the list of IAPs with a particular label:
    1. On the Central web interface, next to search text box, is the "Filter" icon.
    2. Click on the "Filter" icon and it would list out all the labels that has been assigned across devices.
    3. Select the label you need to search for and click on search.

    CarterFamily,
    Essentially, unless something odd is going on, the issue might be an incorrect Registry key entry.  If that is the underlying cause of the problem, then correcting the Registry should allow you to recover your profile.
    You might try the the following fix.
    Find, Open, and follow the procedure in the file named:  Temporary Profile Error
    Kind Regards,
    Dragon-Fur

  • How to compare, current value in :block.text_item with the database value

    Hi
    Could you please tell me
    How to compare the current value in :block.text_item with the corresponding database column value.
    I am using forms 10g
    There is block and there is an text Item in that block.
    When I run the form and query the block (tabular), the :block.text_item shows me, whatever value there in the database.
    Now I add some value in the :block.text_item to the existing value.
    now
    the :block.text_item contains old+ new added value
    whereas
    the database table contains 'old' value
    Now on a button click , I want to find out what is the value that I have added
    Could you please tell me, is it possible without writing a select query?

    Hello,
    Now on a button click , I want to find out what is the value that I have addedSo you mean always user will add value in the existing value. Because this way will fail in one case. Let say
    Value in Database is = ABCD
    User opened the form and he removed the D and write E and now value is ABCE and length is still same 4. So, there is no addition.
    Anyway you can know the database value at runtime there is one property for item called DATABASE_VALUE. It gives the value which is in database while you are running the form before save. and you can use like this..
    Trigger = WHEN-MOUSE-DOUBLE-CLICK on item level
    DECLARE
      vItemValue DATATYPE; -- Set the data type according to your desired field.
      vValueAdded DATATYPE; -- Set the data type according to your desired field.
    BEGIN
      vItemValue:=GET_ITEM_PROPERTY('ITEM_NAME',DATABASE_VALUE);  -- It will return you the database value in vItemValue variable.
      IF LENGTH(vItemValue)>LENGTH(:FORM_ITEM_NAME) THEN  -- It mean something change or added
        vValueAdded:=SUBSTR(:FORM_ITEM_NAME,LENGTH(vItemValue)+1);
        MESSAGE('Added value is : '||vValueAdded);  -- It will show you the added value.
      END IF;
      -- now suppose you want to show the old and new value in message not the added one
      -- Then no need of IF condition. You can just use message like this
      -- And i would prefer to use like this way
      MESSAGE('Old Value : '||vItemValue||'  New Value - '||:FORM_ITEM_NAME);
      MESSAGE('Old Value : '||vItemValue||'  New Value - '||:FORM_ITEM_NAME);
    END;Hope it is clear.
    -Ammad

  • How to get current time in TimesTen

    I need to get the current timestamp of TimesTen DB located node, how can get it?
    In PSQL, I can use built-in function now(), In Oracle, I can use LOCALTIMESTAMP, thanks. a lot.

    Hi Vikas,
    Firstly, the syntax you give
    select to_char(sysdate,'dd-mm-yyyy hh24:mi:ss.FF') as ts from dual;
    does not work in Oracle DB - it gives an eror due to the '.FF' in the format string.
    This syntax does work just fine in TimesTen (which is a little more tolerant).
    However, this is not a very useful thing since the resolution of SYSDATE is 1 second and to accurately measure data fetch times you need accurate microsecond resolution. Also, you would need to take an average over many millions of measurements to get any degree of accuracy.
    Realistically, this will be a very difficult thing to measure with any accuracy. Might I understand what you are exactly looking to achieve here? For the same amount of data, separateing 'fetch' from SQL execution, TimesTen in direct mode will return data much, much faster than an Oracle client/server connection wven when the client is on the same machine as oracle. For Tt client/server mode the data transfer performance will be very similar to that for Oracle.
    Chris

  • How to compare Date/time string

    I read from datalog file including Date/time string ,and want to query the special Date/time string span ,how to compare the data/time string ?

    Hello Joshua,
    To compare date/time you have to extract the different components (day, month, year, hour, minute, second) anyway. Why not "convert to seconds"? I think it's easier to compare one number (where you also can do other math, like calc the difference and so on) than to compare seven (?) parameters with some exceptions... If the dates are read from excel (there was a similar thread some days ago), why not convert to seconds in excel (just a format change)?
    Best regards,
    GerdW
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to get current time

    Hi,
    I would like to know how to get the current time (07H25 for instance).
    Does someone know how to do it ?
    Thanks in advance, Fred.

    java.util.Date = new java.util.Date();
    The above code produces an object which contains a timestamp (date and time) for the instance in which it was created.
    To display it in any format you wish you would use the java.text.SimpleDateFormat class.

  • Compare current value with previous value

    Hello,
    I would like to compare the current value with the previous value of the current value.
    How can I solve this problem?
    Maurits

    Hi,
    after going through the basics course you surely can understand that example:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to compare current to that of immediate record

    Dear Freinds,
                  I have a scenario where i have to compare current  record to that of the previous record by checking any payroll area or employee group or position has been changed .
    could any please give me some peace of code for the above scenario.
    Regds
    syamala

    Hi Symala,
    As per my understanding, suppose if there is any position change for an employee we can get the details history from the table HRP1001-> and the object id AS P for person and the Object number as Personal number.
    Where we can get the list of records with start and end dates. In programe we can take the latest position with start date and end date of previous record and compare.
    Finally, tell me why you are using this comparission, is this for any report to check master data changes with in a period or for any other reason.
    Let me know ur requirement exactly.
    Reward me if helps,
    Thanks,
    Vasu.

  • How to compare Sale data with Previous data

    Hi Guys,
        Any one tell me how we will compare Sales data with Last year Sale data. Is there any T.Code or any kind of Report in the SAP. If available please suggest the same.
    Thanks & regards,
    Naveen Bhatia

    Hi Naveen,
    Did yo ucheck t-code SD01
    Regards
    Rohit.

Maybe you are looking for