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.

Similar Messages

  • Printing current time and date on a pdf document

    I wish for a pdf document to print the current time and date in the same place at the foot of each page, to the following format:
    Aug 04 2009, 5:11 pm.
    How do I do this please? Annoyingly I have managed it in the past, but when I open up my old documents and paste the relevant field into my new document, it either prints the old date/time or else prints the present date/time, but then doesn't refresh the next time I try to print - ie it stays at one date/time.
    I'd like to start again from scratch so that I have a better idea of how it works!!
    Regards
    Tony

    Eureka!
    I now have the answer, and hopefully this will help anybody else with a similar problem.
    In Acrobat:
    Create a text field and place it in the chosen place on the pdf form. Label it "datebox" in the General tab of Text Field Properties, and apply your character styles in the Appearance tab.
    Under the "Advanced" menu, go to "Document Processing" and then "Set Document Actions"
    Click on "Document Will Print" and then hit the "Edit" button. In the "JavaScript Editor" paste the following:
    var myfield=getField("datebox");
    var date=new Date();
    date=util.printd("mmm dd yyyy, h:MM tt", date);
    myfield.value=date;
    Hit OK.
    You have now given the instruction that whenever you print, the field named "datebox" will print the current time and date in the following format:
    Aug 05 2009, 9.37 am
    Regards
    Tony

  • My phone displays "Network search". Current time and date. When the SIM is inserted and when there is no sim

    My phone displays "Network search". Current time and date. When the SIM is inserted and when there is no sim.

    Hi, AlexKot.  
    Thank you for visiting Apple Support Communities.
    It sounds like you are experiencing an issue with your iPhone searching for service.  If you have not resolved this issue, I would recommend trying the troubleshooting steps in the article below.
    If you see No Service or Searching in the status bar of your iPhone or iPad
    http://support.apple.com/kb/ts4429
    Cheers,
    Jason H.

  • 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.

  • My phone displays "Network search". Current time and date. When sim sim svtavlena and when there is no

    My phone displays "Network search". Current time and date. When sim sim svtavlena and when there is no.
    Мой айффон постоянно пишет поиск сети, даже если достать сим карту. Дата и время тоят правильно, сброс сети я пробовал, не помогает.

    Hi, AlexKot.  
    Thank you for visiting Apple Support Communities.
    It sounds like you are experiencing an issue with your iPhone searching for service.  If you have not resolved this issue, I would recommend trying the troubleshooting steps in the article below.
    If you see No Service or Searching in the status bar of your iPhone or iPad
    http://support.apple.com/kb/ts4429
    Cheers,
    Jason H.

  • Where can I find the current time and date of Time Capsule?

    I have a home network consisint of 2 x Time Capsules and 1 x Airport Express.  All is working fine.  I would like to set up access control for one machine connecting to the network and I can see I can do this under Access Control on the Airport Utility.  My question is where can I find the current time and date setting for these devices? 
    I can set them to use the time.apple.com server to set the time automatically, but I can't find where to see the current time and date of the device.  The only place I can see reference to the time and date is on the logs and statistics under the Advanced tab of the AirPort Untility.

    I don't think you can change the time and date on the TC itself, it just connects to a time server (and you set your own time zone).

  • Inserting current time and date in a form

    Feel silly here, but I can't seem to find a way to insert form fields that will display currnet time and date, I see where it can be done for a digital signature, but that's not what I need. This is for a client sign in sheet. I want to know what date and time the form is printed, without having to manually enter that data. Thanks.

    Actualy, looking around the web I found another Adobe forum where you answered another person's question about using a check box to populate a text field with the date, which is actually what I really need, as I want to be able to print the form with or without the date and time appearing. Here's the script you posted:
    // Mouse up script for check box
    {function () {
         // Get a reference to the text field
         var f = getField ("text");
         // Set the value of the text field
         if (event.target.value !== "off") {
              f.value = util.printd("mm/dd/yyy", newDate ());
              } else {
                    f.value = " ";
    I copied and pasted the code straight into the mouse up event for the check box, and then changed the text box name to the actuall name of the date text field, and the error I get is "too much recursion".

  • How To Include Current Time and Date in Form

    Does anyone know how I can include the time and date in the
    body of a form mailer? Our system allows the receiver of each
    submitted form to copy the body of the form entries and paste them
    into either Excel or FileMaker for database building. They would
    like to have the time and date also appear somewhere in the
    submitted body so they will not have to do a seperate copy/paste of
    the time and date seen in the header... I followed the javascript I
    found in the Adobe website and included it within the form, but
    when I ran a test nothing showed! Here is the form...
    Click
    Here to see the Form
    Thanks for your help! -D

    Can you not use when the email's timestamp?
    Also, in z7's script, beware the common mistakes, if you try
    to retype it - .getDate() gives the day of the month (1-31), but
    .getDay() gets the day of the week (1-7). To make it more
    confusing, .getMonth() gets the month (0-11), so you have to add
    one to make it human-readable. The script posted is correct, but I
    went round and round with my PC when I tried to do that the first
    time!

  • Can I change incorrect time and date with

    Hello,
    I used my digital camera in a different time zone and forgot to set it accordingly. Now a bunch of photos have the incorrect time and date. Can I use Photoshop CS4 (11.0.2) to change this? I only found instructions on the Internet for Elements, which I do not have.
    Windows Live Photogallery was only mildly successful. In the Windows 7 Explorer the date is shown correctly, but when I go to open the file in Adobe Photoshop, the old, incorrect date is shown. That's why I hoped that I could change this for good with Photoshop.
    Thanks in advance!
    Aiiyana

    There are several dates in the metadata.  THe date shot is set by the camera and I know that you can not change that in Bridge.  There are programs out there on the web that will do it.

  • Extract time and data with a regular expression

    Hi,
    I have a string with time and date in a HTML statement.
    String s =">19:59, 18 August 2006</a> ";
    // I hope get
    String s1="19:59, 18 August 2006";or
    String s =">18:37, 4 September 1998</a>"Because of different length of months, so how use regular expression to extract it.
    The second question is how to write the string into a file.
    filename =  "A.txt";
                    File file = new File(filename);
              out=new BufferedOutputStream(
                        new FileOutputStream(file));
                   byte[] buffer = new byte[1024];
    // then what?Thank you in advance!

    If "WARNING" can never occur in the input then wedon't have to worry about making the regex not match
    it.
    Hmm, how about fool-proof? :)Bad idea, and impractical or impossible to implement. Excessively defensive coding leads to bloated, hard to maintain code, and a greater likelihood of bugs.
    Code so that you code works correctly provided the preconditions are met. It's the caller's responsibility to meet them. Don't waste time and gunk up your code trying to handle inputs that aren't allowed to occur.

  • How to get system time and date with PHP

    Dear Mr.Craig,
      Thanx a lot. We are running SRM 5.0 (RAMP - Implementation).
      My initial requirement is to write a server-side script to display server date and time. Could you give more inside on how to achieve it?
    Regards,
    Deva.

    Perhaps that will help.
    [code]
    <html>
    <h1>Access System time and date</h1>
    <?
         // saprfc-class-library     
         require_once("saprfc.php");
         $sap = new saprfc(array(
       "logindata"=>array(
       "ASHOST"=>"localhost"          // application server
       ,"SYSNR"=>"00"                    // system number
          ,"CLIENT"=>"000"               // client
          ,"USER"=>"bcuser"               // user
          ,"PASSWD"=>"minisap"          // password
         ,"show_errors"=>false               // let class printout errors
         ,"debug"=>false)) ;                     // detailed debugging information
         $result=$sap->callFunction("MSS_GET_SY_DATE_TIME",
            array(     array("EXPORT","SAPTIME",array()),
               array("EXPORT","SAPDATE",array())));
         if ($sap->getStatus() == SAPRFC_OK) {
        echo "Time: ".$result["SAPTIME"];
        echo "<br>Date: ".$result["SAPDATE"];
        echo "<br>or<br>";
        echo "Server is showing: "
             .substr($result["SAPDATE"], 0, 4)
             ."-".substr($result["SAPDATE"], 4, 2)
             ."-".substr($result["SAPDATE"], 6, 2)
             ." and "
             .substr($result["SAPTIME"], 0, 2)
             .":".substr($result["SAPTIME"], 2, 2)
             .":".substr($result["SAPTIME"], 4, 2);
         } else {
              $sap->printStatus();
         $sap->logoff();
    ?>
    [/code]

  • Update time and date with server time..?

    Hi.. All
    every login ,flash get server time from php. how can i update  time and date in flash..?

    I'm going to only show the month example, the rest is fairly straightforward:
    <?php $month = date('n'); ?>
    var date:Date = new Date();
    trace(date);
    date.setMonth($month);
    trace(date);

  • Display current time and date

    How to display current date and time together in pl sql block
    i have written code below but it gives me error
    SET SERVEROUTPUT ON
    DECLARE
    TODAY DATE;
    BEGIN
    SELECT CURRENT_DATE || TO_CHAR(CURRENT_DATE, 'FM HH:MI:SS AM') INTO TODAY
    FROM DUAL;
    DBMS_OUTPUT.PUT_LINE('TODAY');
    END;
    ERROR at line 3:
    ORA-01830: date format picture ends before converting entire input string
    ORA-06512: at line 4

    Here's how you do it:
    DECLARE
    TODAY varchar2(100);
    BEGIN
    SELECT TO_CHAR(CURRENT_DATE, 'MM-DD-YYYY HH:MI:SS AM') INTO TODAY
    FROM DUAL;
    DBMS_OUTPUT.PUT_LINE(TODAY);
    END;
    Notes:
    1. You select to_char(...) into today, so today should be declared as char, not date.
    2. dbms_output.put_line('today') will print "today", you want to print the variable not the string, so no quotes.
    3. date variables contain both date and time, no need to concatenate

  • Asha 201 Time and Date remains on set value - not ...

    I use a Nokia Asha 201 as a backup handset, so it is not used very often. Recently when i needed to use and after i charged it (the charge had run down) i set the time and date to the current time and date. i noticed a few minutes later that the clock had not progressed, it was still showing the time i set and saved it to. upon setting the time again i noticed that it was also not dispalying the date and time on the hoem screen as it always did, with all the settings still the same. it only shows "-------------" on the home screen. up to now it still appears that the clock (time and date) does not progress but remains showing the values i set it to. when accessing some of the other apps, i receive a prompt to set the date and time. Restored it to factory default settings a few times and reinstalled updates/firmware as well, with no success. Any advice please?

    I have the same problem!

  • How to get System Time and Date?

    Hi, may i know how do i get the System's current Time and Date?? And i need to format them into 2 separate String, that's Time is a String, Date is another String. Pls guide me. Thanks a lot!

    What's the problem? The previous example was pretty clear. Just adapt it to your purposes...
            Date currentDateAndTime = new Date();
            SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
            SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
            System.out.println(dateFormat.format(currentDateAndTime));
            System.out.println(timeFormat.format(currentDateAndTime));

Maybe you are looking for