Unix time to standard time

hi,
i am writing a program to convert Unix time in the normal date. I wrote the
following program. The Input is not converted properly to the normal date.
It prints date without any issue but the time is not correct. As per the java docs
about the date constructor the value should be calculated from
01/01/1970 00:00:00 but mine one by default shows 01/01/1970 07:30:00
I don't know from where 07:30 is coming by default.
Looking forward for the suggestions.
import java.io.*;
import java.util.*;
import java.text.*;
    public class unixTime{
        public static void main ( String [] args ) throws IOException
            int dateinsec = 0;
               long t =  dateinsec * 1000L; 
               SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
               Date regDate = null;
               regDate = new Date(t);
               System.out.println("Formatted date is: " + formatter.format(regDate));
    }Thanks.
Corrected thanks
Edited by: vinee on Oct 7, 2008 2:10 AM

vinee wrote:
Sorry i didn't check earlier that i posted at the wrong place.
Extremely sorry.No worries. Just don't do it again please.
In the future, if you do post in the wrong place and want to repost the question in the right place, just go back to your original, and provide a reply that says something like "move to" + the URL of your new thread, so there's one coherent discussion and people don't duplicate each others' efforts.

Similar Messages

  • VI to convert Unix time to standard time?

    hi,
    I am in need of a VI to convert Unix time to Standard time?
    eg: Unix time: 1268845177 in seconds
    Standard time: GMT: Wed, 17 Mar 2010 16:59:37 GMT
                            Your timezone(U.S):
    Wednesday, March 17, 2010 10:59:37 AM
    I have the calculation but not full formula.
    Unix time is in seconds from Jan 1,1970, 00:00:00 UTC, starting at 0 counting forward.
    When 1268845177/86400 = 14685 days.
    86400 = 60*60*24 seconds
    But how to convert the 14685 days and relate to the current date, how it should be done?
    Either the formula or a VI to convert Unix time to standard time will be a help.
    Regards,
    Arvinth

    Timestamps and the PC clock vs. time on the net are different and I'd say somewhat unrelated concepts.
    You are worried about accuracy of the current time.  Timestamps have nothing to do with current time, but are a way of identifying and particular moment in time.
    Yes, the PC clock gets its time from the net assuming the time server settings are all set properly.  Even the correction of the current PC time may not happen exactly when the leap second gets inserted.  It may be some time before the PC resynchronizes with the net time.  The PC doesn't know if the existence of when a leap second will occur.  And neither does the LabVIEW timestamp.
    Here is an example.  According to http://en.wikipedia.org/wiki/Leap_second, a leap second will occur at the end of June 30 of this year UTC.  Since my clock is eastern daylight time at that date, I put together an example for 8pm on June 30  (UTC +4).  You'll see that the 3 values (a second before, the exact time, and a second after) show they are all 1 second apart.  There is no extra second accounted for.  So in real life the time a second after  vs. a second before are actually 3 seconds apart, but LabVIEW only show 2 seconds.  Feel free to play with the attached snippet for different timezones and daylight savings time and all of that.
    I don't think you really have as big of a problem as you are trying to investigate here.  If your timing needs are that critical where you need accuracy of the current time to better than a second, then you shouldn't be looking at LabVIEW timestamps, PC time clock, or internet time at all, but look at a high accuracy timing source perhaps based on a GPS clock.
    Unless you have a particular test planned to run over the expected point of time where a leap second is inserted, then you shouldn't have to worry.  Even if you do have a test run over the leap second, you probably don't need to worry either.  If the test is based on a waveform datatype, then you have a T0 timestamp, and a dT that will keep track of all the individual data points accurately.
    Attachments:
    Example_VI.png ‏20 KB

  • Calendar alert times in "standard time"

    So we (mostly) are now on Standard Time. I use Calendar (all day) alerts as a sort of to-do list, the notifications being very handy for this (thank you Apple for fixing some Mavericks calendar weirdness  in Yosemite - my other support question regarding Calendar in Mavericks appears to be fixed in Yosemite).
    However, when I set an alert for a particular time, it indicates that the alert will be one hour later. To be clear, when I look at the "custom" alert time, it is what I set it for - but when I look at the alert time for the event in the event information, it is one hour later. BUT it appears to "notify" at the time I set it to.
    So for example, if in the "alert" setting for the event, if I select "custom" and enter a time - that is the time that the notification occurs. BUT the "alert" line indicates it will occur for a time one hour later. WTHeck?
    Been checking preferences in Calendar and iCloud. Can't seem to fix it. Or am I just misinterpreting it?
    Hope this question makes sense ...

    Uh, this may fall into the Emily Litella Category.
    The all-day events I refer to above were pulled forward across the Standard Time change (in other words, they were created under Daylight Savings Time). Calendar (or me) appeared to be confused by this today (the first day of Standard Time).
    I just pulled them forward again (in other words from one Standard Time day to another) and now Calendar is treating them as it should.
    So hopefully, that will be true tomorrow. "Never mind."

  • CONVERT TIME IN HOURS INTO STANDARD TIME.

    Hi All,
              I have time in standard time format for Ex. 07:00:00 . And I want to add 4 hours and 30 min into that time. That means after adding my output I want like this 11:30:00. That means time is now 11 pass 30 min 00 seconds.......Plz tell how to do this............
    Regards.
    Pradip Pawar

    Hi Pradip,
    you can do it by the way Anji told you.
    I didn't try but guess
    what will be the result of '<b>21:00:00</b>' and '<b>04:30:00</b>'  ?
    Declare variable time1 , time2 and time3...
    Time1 = '21:00:00'.
    Time2 = '04:30:00'
    Time3 = Time1 + Time2.
    write /  Time3 USING EDIT MASK'__:__:__'.
    See the output...
    For getting solution of this problem...
    You should convert the time into SECONDS for both time valuse
    Then add those seconds
    Then again convert it into HH:MM:SS...
    Hope it will help you
    Please correct me if i am wrong.
    <b>Reward Points if it is helpful.</b>
    Thanks & Regards
    ilesh 24x7

  • Name for standard time format?

    Is there an official name that describes the Java standard time representation?
    I think Java standard time defines two important things and I wish I could refer to them with a single, short, accurate name. The two things the standard defines are:
    1) An epoch from which time is measured. The epoch is midnight, Jan 1st, 1970 AD, GMT.
    2) The standard form of expressing time is in milliseconds (not seconds, not days) since the epoch.
    Everytime I write a document telling someone that a time will be or should be expressed in this way, I have to write a description.
    "express time in millis since midnight jan 1st, 1970 AD"
    Is there an official (and much shorter) way of saying the same thing? The UNIX time standard, on which this is based, also seems to not have a name. The POSIX time standard seems to be wrong in that it doesn't handle leap years correctly.
    By contrast, it is easy to find a half-dozen web-sites that can tell you, definitely, what a Julian date is. The Julian date standard defines both an epoch (noon on jan 1st 4713 BC) and a standard way of expressing time as days since the epoch and fractions of days since the epoch.
    Can anyone help me out? Is there an official name? Can we bestow one? Java Standard Time would be fine with me, but it won't work if I'm the only using it.

    I don't think it really needs a name. Within Java we
    can just say time in milliseconds and assume the
    standard origin.Yeah, I agree with you, but I'm not really sure it would help the original poster to just assume that the origin is standard. Have you ever noticed how many people post questions about java.util.Date that are caused by a total inablity to understand that the class is nothing more then a wrapper for a time elapse ('how do I swtich the month to Januaray, why is the system time a huge number')? People new to programming seem to have a hard time understand dates as a distance from some origin in time, rather then a calendar expression, and Sun compounded the problem by including those deprecated calendar-specific methods in the original API (creating the impression that it is a calendar class). I don't think any one but senior level programmers will be able to sense the implied origin, even though your point that all computer dates use that epoch as a standard origin is correct.

  • Ical all day events show over 2 days during standard time (Nov-Apr)

    Any all day event (either a holiday or an event I have repeating every year like a birthday) I have on my calender during standard time (from November to April) shows over a two day period.
    For example, Christmas Eve shows up on Dec. 23 and 24.
    I have tried syncing with time zone support on and off. I have tried using the same time zone in a different hemisphere. I had this problem last year and again this year. Once we switch to daylight savings the event show correctly.
    Any suggestions?

    Thanks for the link--seems I'll just have to deal with the Palm/iCal calendaring anomalies. Do these "representation disconnects" have anything to do with the weird behavior of my iCal calendars, now that I've synced my palm data to iCal? Immediately after the original Palm/iCal sync, the calendars came up in iCal with no problem. Once I quit iCal, however, and then re-opened it, the list of calendars had disappeared from the "Calendars" pane to the left of the grid, and all of the events had disappeared as well.
    As someone reported elsewhere in this forum, changing the viewing mode (day, week or month) causes the events themselves to reappear, but the "Calendars" pane remains blank.
    I had hoped to ditch palm desktop and streamline my calendar /contact--computer/iPhone syncing, but iCal's odd behavior is making me question whether or not it is stable enough to fully rely on.
    Is there anything that will make the calendars and events perform more reliably?
    G5-Dual 2.5 GHz Mac OS X (10.4.10)

  • Ical invites seen off by 1 hour in Outlook for IST (India Standard Time)

    Hi,
    I have this strange problem since I migrated to MAC recently and started using iCal.  Earlier I was using Thunderbird with Lightning.  I am in the India time zone (IST).  Whenever I create an appointment using iCal and send invites (using MAC Mail) to meeting participants, the Outlook users among the recipients see the meeting at a time that is an hour ahead of the scheduled time. Lightning users get the invite correctly.  Both my Mac and the recipients are using IST timezone.
    Please note that India does not use daylight saving.  I dug into the problem a bit and I have a speculation about what is going wrong.
    India used daylight saving briefly in 1942.  The VTIMEZONE specification generated in the ics by iCal seems to specify that daylight savings is used since May 15, 1942, and standard time is used since Sep 1, 1942.  My speculation is that Outlook interprets this as saying that daylight saving is in force today (July 2013), probably just ignoring the year specification.  Other calendar applications possibly are unaware of this bit of world war II history.
    Any way that I can get iCal to not include the timezone information or to modify its 1942 memory?  Currently, I am creating all appointments using UTC but that's obviously not pleasant.
    Here is a paste of the relevant data in the ics file.
    BEGIN:VTIMEZONE
    TZID:Asia/Kolkata
    BEGIN:STANDARD
    TZOFFSETFROM:+0630
    DTSTART:19420515T000000
    TZNAME:GMT+05:30
    TZOFFSETTO:+0530
    RDATE:19420515T000000
    RDATE:19451015T000000
    END:STANDARD
    BEGIN:DAYLIGHT
    TZOFFSETFROM:+0530
    DTSTART:19420901T000000
    TZNAME:GMT+05:30
    TZOFFSETTO:+0630
    RDATE:19420901T000000
    END:DAYLIGHT
    END:VTIMEZONE

    Hi, any thoughts here?  I tried replacing the system timezone file for IST with a vanilla +0530 GMT offset one (in /var/share/zoneinfo) but that didn't work (even after a reboot).  Does Mail (and other such applications) not use the system timezone definition files?

  • Switch to standard time from daylight saving causes error - iOS 7

    Hi there,
    Today (27-Oct-2013) the time was switched back from daylight saving to standard. When looking my iPhone, I noticed that although the clock correctly displays the current time, the standard weather app still uses the time according to daylight saving (i.e. showing one hour ahead) and what is more interesting, the calendar acts weirdly, showing the correct time, but placing it in the old daylight saving time, i.e. 7:46 AM is shown as a line between 8:00 AM and 9:00 AM! It is really ridiculous and it seems I cannot change these. I restarted my iphone, turned off and on again using carrier provided time, but nothing changed. Any clues?
    Using iPhone 5 and iOS 7.0.2.
    Any help is appreciated.

    Problems with time, time zones have been quite common. Clearly, my brand new, the most forward thinking smartphone has the same bug. Sometimes I wonder why Apple is unable to get basic things work? they simply don't care, that's all.
    Issue with the line materializes itself on my iCal on iMac as well
    I hope, at least alarm will go off at the right time Monday morning
    BTW:  last year when I was on trip to Chile, at one night - suddenly - out of the blue - time changed on all our apple devices.. it's bad when you've got your flight next day and don't know when to wake up weeks later I have found out information Apple did not update their list of timezone changing dates.. for couple of years...

  • Instance Time taking into account Daylight Standard Time

    When scheduling a report, the instance time does not seem to take into account Daylight Standard Time. This is probably because the United States is different than the rest of the world. Any chance this will be fixed in upcoming releases? Either that or I can just wait a few more weeks for the world to catch up.
    Instance Time: 3/27/2009 08:30:21
    Actual Time: 3/27/2009 09:30:21

    Hi Mike,
    You are correct, the times you mention do not take the early daylight savings time change into account.
    You should see the times become correct again when we hit the original time change date which I think would have been Sunday April 5 this year.
    Cheers,
    Steve

  • Approval view for working time empty fields 'message' and 'standard time'

    Hi experts,
    We want to use the SAP-standard program to approve working hours in the Portal. The basic settings are all done, but we still have a problem with some fields.
    When we use the SAP-standard approval view SAP_LINE (IMG --> Define approval views) and we go to the portal we see that the fields 'message' and 'standard time' are filled and the hours with a warning are red. When we create an exact copy of view SAP_LINE with the same detailscreen selections, the fields 'message' and 'standard time' are empty and the warning does not turn red.
    See the print screen below for an example.
    http://img641.imageshack.us/i/printscreenapproveworki.jpg/
    Can someone please help me with this?
    Thank you in advance.
    Kind regards,
    Bob

    Hi,
    We have found the place to change this fields.
    To change this fields we had to create an enhancement implementation for BADI definition 'HRCATS_APPR_CUST'
    Information for this can also be found in the IMG documentation.

  • Site synchronization and daylight savings/standard time

    The familiar problem of Dreamweaver not accounting for the
    change from Daylight Savings to Standard time persists with CS3.
    This only shows up on Windows machines. Windows (tested with both
    XP and Vista) maintains all file times in UTC, and changes the
    locally displayed time based on the time zone. The remote servers
    are all Linux boxes running Apache. DW connection is through SFTP.
    Dreamweaver appears unable to figure out the local time stamp
    offset imposed by Windows. After changing from Daylight Savings to
    Standard time, Check In operations produce a message that all
    remote files are dated an hour later than the local files. This is
    the opposite behavior one sees in the Spring, when the change from
    Standard to DST has Dreamweaver believing all remote files are an
    hour out of date.
    In the past I have manually changed the file modification
    times on all files for every site. Given that this comes to several
    hundred thousand individual files, it is a pain. Searching yet
    again for a method to convince Dreamweaver to correctly interpret
    the file timestamps produced little more than Google's listing
    thousands of search hits for other folks mentioning the same
    problem.
    It made no difference which timezone the server was in (or
    set to) relative to the PC running Dreamweaver. The timezones could
    be identical or different -- DW always complained the remote files
    were an hour later than the local ones. I changed timezones on both
    the server and the local machine. No help. Neither was rebuilding
    the site cache nor manually deleting the WinFileCache*.dat file. I
    also tried manually editing a dwsync.xml file in a _notes folder to
    see if I could alter DW's view of the world. Again, no such luck.
    Making matters far worse, however, Dreamweaver complains
    about file time differences in newly modified files as well. A
    standard Synchronize command produces "Resolve" errors for every
    newly modified file that is not first checked out from the remote
    site using DW, saying both local and remote versions have changed
    since the last sync. Running "Check In" on a newly modified file
    that was not explicitly checked out (e.g. an image or other binary
    file) does nothing, as DW sees a timestamp discrepancy. These files
    must first be Put to the site, with the corresponding DW error
    dialog, and then be checked in.
    I am suspecting the problem stems from Dreamweaver's lack of
    support for the
    MDTM
    command. Many other products, ranging from commercial packages
    such as WS_FTP and Microsoft's Expression Web, to $30 shareware
    programs such as Beyond Compare, to freeware programs including
    WinSCP all correctly interpret Windows timestamps as well as
    preserving the correct time upon file uploads. Is there any
    solution other than changing the timestamps by an hour on every
    file or getting every file from all sites to satisfy Dreamweaver's
    belief that the files are all an hour newer than they actually are?
    The former is a non-trivial task given the sheer number of files to
    change; the latter is a bandwidth PITA for ~90GB of data.
    Message to Adobe: Please fix this problem. It hits users
    connecting Windows local machines to Linux servers twice a year.
    Your competitors as well as shareware authors have sorted this
    matter out.

    Ethan H wrote:
    > The familiar problem of Dreamweaver not accounting for
    the change from Daylight
    > Savings to Standard time persists with CS3.
    Yes, it's a bug, and it's a PITA.
    > Message to Adobe: Please fix this problem.
    Message to Ethan H: This is a user-to-user forum. To get the
    message to
    the right people in Adobe, submit a bug report:
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    Yes, I'm sure that Adobe knows about the problem without you
    going to
    the effort to submit a report, but the bug report/feature
    request form
    is how the development team assesses its priorities.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • UNIX time to Oracle time

    Hallo,
    I am acquiring the data for my reports in a UNIX evironment using embedded SQL.
    Therefore I am searching for a function that converts the UNIX time to ORACLE time. Currently I am doing the conversion via a string representation but I would prefer a function that does it on a binary level.
    Thanks a lot - Ulrich

    maybe (using the link provided) ;)
    select case when :unixts between -2114380800 and 2145916799
                then TO_DATE('19700101000000','YYYYMMDDHH24MISS') + NUMTODSINTERVAL(:unixts,'SECOND')
           end the_date
      from dualRegards
    Etbin

  • Calendar / Standard Time Issue

    Is there a way to fix being an hour too early to all my meetings since the switch the Standard Time? Is there a setting or an app to fix this issue?
    New to Android and still figuring out this landscape.
    Thanks for the help!

    Thanks, NexusMan21 -- but that hasn't worked. Tried multiple settings and process of elimination. No go.
    Seems to only happen on recurring meetings that were set prior to time change.
    Any help is appreciated!
    Thanks

  • Hi Guys, when iOS 6 coming as per indian standard time. Thanks in advance

    Hi Guys,
    When iOS 6 coming as per indian standard time. Thanks in advance
    Thanks & regards
    Parvee

    iOS 6 will be available on Wednesday September 19 in the U.S. the actual time is not known. Therefore there is no way anyone can know when it will be available in your local time zone. Best is to keep checking if you need it that fast.
    Keep in mind that update servers will be under high demand and may not repnd propery. It might be best to wait a week before try to update.

  • Please let me know the sample format of the standard time characterstics..

    Hi Please let me know the sample format of the standard time characterstics..
    Calendar Day-0CALDAY-->
    Calendar Year/Month-->
    Calendar month-->
    Quarter  -->
    Calendar year/quarter-->
    Calendar Year/Week-->
    Calendar Year-->
    Fiscal year / period-->
    Posting period-->
    Fiscal year variant-->
    Fiscal year-->
    Halfyear-->
    Weekday-->
    When coming to format of 0calday i am confused whther to use  20111024 (or) 20112410
    Thanks...all

    HI
        check the link
    http://www.sapdb.org/7.4/htmhelp/48/0d8018b4f211d2a97100a0c9449261/content.htm
    Format
    EUR
    'DD.MM.YYYY'
    INTERNAL
    'YYYYMMDD'
    ISO/JIS
    'YYYY-MM-DD'
    USA
    'MM/DD/YYYY'

Maybe you are looking for

  • Purchase goods receipt base on components

    Dear Guru , We have one requirement which is the purchase goods receipt is base on sales bom components level . For instance , in system we have A material number and it have 3 sales bom components : B , C and D . And we created one Purchase Order on

  • Why can't I access the internet via ethernet port on my Airport Express?

    I have an Airport Extreme base station and two Airport Express units. The Extreme is connected by ethernet to a BT Home Hub (BT is the internet provider). The network works for all the other computers that have Airport cards BUT I want to connect a M

  • Getting "An unknown error has occurred" when trying to save a new contact

    Scenario: Using Outlook 2003 and Oracle Connector for Outlook 10.1.2_03 against an OCS 9 installation. When I make a new contact and try to save it I get an error message in a popup window (with the title "Microsoft Office Outlook") with the text "An

  • How to implement a linked list in oracle ?

    HI All I want to know if there a way to implement a linked list in oracle ? Thanks in Advanced Naama

  • Image Burn-In (still images)

    Does anyone have any info/experience with image burn-in? As in where images are permantly burnt onto TV screens. I'm doing a training DVD which will have various slideshows like a powerpoint. Some slides may be up for a while, plus there would probab