Date - 00:00:00 GMT, January 1, 1970???

Hi:
How do I turn this long into a Date?
This is for the lastModified() function of the File object:
"A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)"

Try this:
Date lastMod = new Date(myFile.lastModified());Regards,
Dave Gilbert
http://www.jfree.org

Similar Messages

  • My 3gs keeps switching itself off and when i turn it on, the date is set to 1st January 1970

    I Have an Iphone 3gs that keeps switching itself off and when i turn it on, the date is set to 1st January 1970 :S   ... many software resets and updates won't do any good .. repaired at the manufacturer twice for the same, and works till it happens again on it's own. When it was repaired, the fix was mentioned as a reset done for the device. I have a friend who is alse havng same issue.
      can someone tell what is the reset that can be done to tr and do it from my end plzzz?

    Sounds like the battery is dead.  Bu try the following to rule out a software problem:
    - Reset the iPOd
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup
    - Restore to factory defaults/new iPod.
    If still problem your battery is very likely dead.  An appointment at the Genius Bar of an Apple store is in order.

  • UTC timestamps in milliseconds offset from January 1, 1970

    Hello,
    The problem is that I must generate miliseconds offset from jan-1-1970 for a java app from my PL/SQL application.
    how do I can, from a given datetime, get UTC timestamps in milliseconds offset from January 1, 1970?
    I'm in the Canada/Eastern time zone and I'm using the following function:
    CREATE OR REPLACE FUNCTION date_to_float (dt IN DATE)
    RETURN FLOAT
    IS
    BEGIN
    RETURN 24 * 3600 * 1000 * (NEW_TIME (dt, 'EDT', 'GMT') - TO_DATE ('1970-01-01', 'YYYY-MM-DD'));
    END;
    so when I use this function to generate events after the november 2nd, the hour isn't accurate on the application side because the static usage of new_time with EDT source timezone.
    How can I make this function reliable over time?
    Thanks

    It looks like you are looking for the unix style epoch time:
    This code will give it to you plus allow you to configure the resolution, by default it will return the number of seconds since 1-Jan-1970, but by varying either the scale or precision you can get more or less detail, and you can even change the date epoch date used in the calculation.
    create or replace
    function date_to_epoch(
          p_date timestamp with time zone default systimestamp,
          p_scale number default 1,
          p_precision number default 0,
          epoch timestamp with time zone
              default to_timestamp_tz('1970-01-01 utc',
                                      'yyyy-mm-dd tzr')
      ) return number is
        tmp interval day(9) to second;
        sec number;
      begin
        tmp := p_date-epoch;
        sec := extract(day from tmp)*24*60*60;
        sec := sec + extract(hour from tmp)*60*60;
        sec := sec + extract(minute from tmp)*60;
        sec := sec + extract(second from tmp);
        return trunc(sec*p_scale,p_precision);
      end;Edited by: Sentinel on Aug 28, 2008 3:14 PM

  • My Phone Thinks it's January 1st, 1970. How Do I Bring it Back to the Future?

    I've never actually seen that movie, I'm sorry if I don't understand any references.
    Okay! So, here's the run-down. I have an LG Lucid 2. I am in England right now studying abroad for the year, and I have suspended my phone service, and have only been using wifi when it's available. When I got into the UK, my phone was still on USA Central time. I have searched the phone, and the manual, and an online version of the manual, and have not been able to find a way to change the date and time manually. Now, this ordinarily wouldn't have been a problem, but then I took my SIM card out (wanted to see if the SIM cards they've been giving away here would fit in my phone if I got it unlocked from Verizon and not have to get a new phone to use here, but I did not put the other SIM card into the phone) and put it back in and started the phone up. This is when it time-traveled. It started back up at 6:00pm, January 1st, 1970. So now, a lot of my apps aren't working because they're demanding I change my date and time, but when I go to do that, the only options I have are to change the date and time /format/. I just want to get my phone onto the right time. I even tried to hard reset it, but when I held both the power button and the volume button after turning it off, it came to a screen that said something like "Downloading Screen, Do Not Unplug Device Until Finished" or something like that. If I didn't touch it, it would stay like that. If I touched the power button like the manual says to do, nothing happened. I could only get one thing to happen - which is for it to start back up again with all of my apps and media and settings. So. That didn't work. Please help. Please. I am tearing my hair out over this and after waiting an hour, staring at the livechat button, willing it to turn on, I've had no luck.

    Just for asking can you post a screen shot of the Date and Time settings,  Like shown below"  press either the Lower volume and power or upper volume and power the 2 that snaps a screen shot once you've done that if ya know how to post a S.S.  post it to thread and that way it will give us a Look at your settings..
    Here's a Screen shot of my Droid Maxx with the Date and Time..

  • ICal reset to January 1, 1970

    My 3GS was repaired recently and when I got it back, iCal was reset to January 1, 1970. How do I change it to the current date?

    Hmm. Not sure what is going on there.
    Try powering it completely off and then on by holding down button on top until it allows you to slide to power off.
    The restore as a new device if necessary(unplug at the new/from backup screen to test before setting up as new.
    Worst case scenario: ask for an out of warranty repair price, if it is out of warranty.
    Articles on how to do these things are on apple website, but my be easier found on Google.

  • Birthdates Prior to January 1, 1970.

    We recently installed Eloqua and I am just learning the system.  I am attempting to segment on birth date – specifically customers who have a birthdate between 04/21/1951 and 04/21/1980 (customers who are between 35 and 64 years of age).  I receive an error message when I validate the segment.  I have isolated the issue to the date of January 1, 1970 – any date prior to January 1, 1970 errors out.  But the segment works great with dates on or after January 1, 1970.  Any insights would be appreciated.

    You could write a function to manually calculate it yourself based on knowing the number of milliseconds in a second, the number of seconds in a minute, the number of minutes in a hour... and so on. So you could parse the date, and then go from there.
    No build in Java date function or class is going to help you though, I don't think.

  • Why Date() return local and GMT time intermixturely

    I have following code in my Java application:
    Date dt = new Date();
    System.out.println("Local Time: " + dt.toString());
    I got local date (CST) at most time. But I got GMT format date few times within hours' running by the same code and the same running, which will crash my DateFormate later.
    Can anyone tell me why this happened? Is there any way I may use to make sure of that "new Date() will return only one date format, local or GMT"?
    Thanks.

    Do appreciate of your reply. In my application, I do use new Date() and DateFormat.format() like you suggested. But I caught following exception. Then I use Date.toString() to test Date and found that " new Date() return local time (CST time) and GMT time intermixturely". Most time, my application got CST time string and my SimpleDateFormat("yyyy.MM.dd' 'HH:mm:ss:SSS") works well. But few times a running, new Date() return a GMT time string, then I got following exception. I was confused by why one statement "Date dt = new Date();" in one running return both CST and GMT time.
    java.lang.IllegalArgumentException
         at java.util.SimpleTimeZone.getOffset(SimpleTimeZone.java:427)
         at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:1173)
         at java.util.Calendar.complete(Calendar.java:1058)
         at java.util.Calendar.get(Calendar.java:916)
         at java.text.SimpleDateFormat.subFormat(SimpleDateFormat.java:481)
         at java.text.SimpleDateFormat.format(SimpleDateFormat.java:410)
         at java.text.DateFormat.format(DateFormat.java:305)

  • My iPad randomly dies and when it reboots the date comes up as 1st January at 10pm?

    My iPad randomly dies and when it reboots the date comes up as 1st January at 10pm?

    Hello zoeeeeee,
    Thanks for the question, that definitely sounds frustrating.
    This may be a good opportunity to restore the iOS software that is running on your iPad. The following article outlines how to do so:
    iTunes: Restoring iOS software
    http://support.apple.com/kb/HT1414
    Thanks,
    Matt M.

  • I bought an ipod a year ago, and recently when it's plugged to a computer (charger, docks, etc)it charges, but almost everytime that I unplug it it turns off, and when I turn it on again, the battery is in red and the date is january 1, 1970.

    What is the problem  with my ipod? what can I do to solve it, I even restored it once

    Sounds like the battery is dead.  Bu try the following to rule out a software problem:
    - Reset the iPOd
    Reset iPod touch:  Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup
    - Restore to factory defaults/new iPod.
    If still problem your battery is very likely dead.  An appointment at the Genius Bar of an Apple store is in order.

  • Problem in converting the String to Date with time zone GMT

    Hi,
    When I tried to convert the string 12/05/2009 to Date, the time zone is set to BST.On the other hand, for the date 12/12/2009, the time zone is set to GMT. What should I do to get the time zone as GMT all the time.?
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    String dateString = "12/05/2009";
    System.out.println(myDate.toString());

    I think you are all missing the point. java.util.Date objects always alway always store the date as the number of milliseconds since 1/1/1970 UTC so the only TimeZone they have its the implicit UTC. When you use the Date.toString() method the toString() method gets the default time zone from your environment and formats the data accordingly. This means that the same Date object will, by default, produce a different result for France and Australia and the US.
    So, if you have the date "12/5/2009" as a String then to convert it to a java.util.Date you must specify what TimeZone is implied. If it is your system time zone then you can just create a SimpleDateFormat object with the correct format and then use the parse() method to create the java.util.Date object and this will automatically be converted to UTC. If the date String represents some other time zone then you must explicitly set the time zone of the SimpleDateFormat object before parsing the string.
    The same approach applies when converting a java.util.Date object to a String. If you want anything other than your system time zone then you must explicitly tell the SimpleDateFormat what time zone you want the result formatted for.

  • Formatting a date that should be GMT

    Hi,
    From an API I get time in milliseconds and I put that value into a java.util.Date object. The time is in UTC and my local time zone is EST. I want to display this value, adjusted to the user specified time zone, but I can't get how to tell the Calandar class that the time I giving it is UTC and not EST, so it is adjusting it wrong. Also, I can't assume what the local timezone will be. So far my code looks like:
       // date (Date), gmtOffset (int) and format (String) are method inputs
      int offsetAdjusted = gmtOffset * (3600000);
      SimpleTimeZone tz = new SimpleTimeZone(offsetAdjusted,gmtOffset+":00");
      Calendar cal = Calendar.getInstance( );
      cal.setTimeZone(tz);
      SimpleDateFormat dateFormat = new SimpleDateFormat(format);
      dateFormat.setCalendar(cal);
      System.out.println(dateFormat.format(date) );any help would be very much appreciated.

    import java.awt.*;
    import java.text.*;
    import java.util.*;
    import javax.swing.*;
    public class ShowingGmtTime
        public static void main(String[] args)
            String[] ids = TimeZone.getAvailableIDs(+8*60*60*1000);
            for(int i = 0; i < ids.length; i++)
                System.out.println(ids);
    DateFormat df = new SimpleDateFormat("HHmm ddMMMyyyy");
    Date now = new Date();
    System.out.println("local time = " + df.format(now));
    TimeZone gmtZone = TimeZone.getTimeZone("GMT");
    df.setTimeZone(gmtZone);
    System.out.println("GMT time = " + df.format(now));

  • Email Templates and Date and Time in GMT Format

    How do I send the date and time captured on the service form to the customer and not how it renders in GMT when sent in the email template
    Solution: Copy the service form field into a hidden field.  Reference the hidden field in the email template and it appears in the email template as entered on the form.

    But what about a system generated date/time like trying to notify a task assignee of the due date/time of their task?

  • Date shows as correct day-January(for any month)-correct year;

    For example: 2011-09-05 shows as 5 January 2011.
    This is transferred onto all date stamps on documents in mail, i-photo etc
    In mail inbox I can correct the issue by narrowing the time, date column, wwhich then shows correct numerical date values, but 'January' is still incorrectly printed on reply emails etc.
    This is a serious problem as we have to keep logs of correspondence etc.
    Has anyone experienced a similar problem?

    System Preferences>Language & Text>Formats.
    Set it up the way you want it.

  • Convert Local Date and Time into GMT

    In Oracle how to convert date & time in GMT. Suppose the input will be local date & time e.g. ‘IN’, ‘15/11/2010 15:20:30’ ( country Code, DD/MM/YYYY Hr:Min:Sec in 24hr format) output should be in GMT format.

    I don't think this should be in the OLAP subforum. At least try to look for the correct section before posting next time.
    Apart from that, you can try a combination of the From_Tz and Tz_Offset functions.
    http://www.techonthenet.com/oracle/functions/from_tz.php
    http://www.techonthenet.com/oracle/functions/tz_offset.php
    I hope it helps.
    Joan

  • Convert date in BST to GMT format

    Here date and cal.getTime() return date in BST format. But my requirement is date should be converted to GMT format and then compared with cal.getTime() which is in BST format.
              Object o = timeStamp.get(TIMESTAMP_OBJECT);
                java.util.Date date = (java.util.Date) o;
                Calendar cal = Calendar.getInstance();
                getBDO().setLastDespatch(isLastDespatch(cal.getTime(), date));
    public static boolean isLastDespatch(Date counterDate, Date lastDespatchDate)
            if (counterDate.before(lastDespatchDate))
                // last despatch timestamp before
                return false;
            else
                // last despatch timestamp expired, therefore tell clerk
                return true;
        }I tried
    Object g = date.toGMTString();
    But I am not able to convert this object to again Date...

    NewComer_forum wrote:
    I tried with below code but throwing exceptions
    String g = date.toGMTString();
    SimpleDateFormat date1 = new SimpleDateFormat(g);
    You of course read the Javadoc, and so know that the argument to the constructor SimpleDateFormat(String) is the pattern by which you want to parse, and not the string you want to parse itself, right? I mean, you didn't just try one random thing to prove that you gave it a minimal effort before coming back here for more handholding, correct?
    Do me a favour and try my suggestion before continuing. I don't know for sure that it will work, but I think it's likely.

Maybe you are looking for

  • Urgent!  HELP_VALUES_GET_NO_DD_NAME replacement

    Hi,     When replace 'HELP_VALUES_GET_NO_DD_NAME', I don't know how to fill the return value 'P_IND'. ""ローカルインタフェース: *"  IMPORTING *"     VALUE(P_CUCOL) LIKE  SY-CUCOL DEFAULT 0 *"     VALUE(P_CUROW) LIKE  SY-CUROW DEFAULT 0 *"     VALUE(P_DISPLAY) D

  • Windows 7, Oracle DB, Instant Client and VBScript

    I'm trying to to connect to a Oracle database via vbs on a Windows 7 machine using the instant client.  I get an error [Oracle][ODBC][Ora]Ora-12560: TNS:protocol adapter error Code 80004005.  Script still works fine in XP using the Microsoft ODBC for

  • Data Migration (FI/CO)

    Hi, Kindly let me know the process for data migration from legacy to SAP system. The client wants us to migrate not only the open items but also all the line items (since there are not much transactions as the company was newly incorporated). We are

  • Change content of the PO while using Approval Procedures

    When a PO is created as draft and waiting for approval we were able to find it back in the draft request list but not be able to do any change in the PO. Is there any possibility to allow changes in the draft PO before the approval was done? Also we

  • Firefox 4 is not useable. The window hang and never reconnect. There is a serious problem with this release - how do I fix?

    When the update first came up - I as always clicked yes to let it update. However, after update I got an error message that would pop up real quick then close the browser. I tried opening the browser several times - each time it closed it's self. So