Finding time stamp in java

Dear friends,
I am new in java. I would like to convert epoch second to actual date .
I have used this below line in my application it has given worng date.
Date now=new Date(Integer.parseInt(callid[1])*1000);
String date = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(now);
System.out.println(date);
Note:  callid[1] is having epoch second in string manner. That epoch second is *"1279538252"*
Output of this above code is,
* 28/12/1969 00:56:37*
But actual date of the epoch is,
* Monday 19 July 2010 04:47:32 PM IST*
What I have done wrong here ?
Please help me..

geziefer wrote:
Well, you are right - but speed is I guess the least of all concerns here.I'm talking about the fact that I responded after you - not the speed of your code.
I only wanted to outline that he started out with Integer instead of Long.My solution was to use 1000L rather than just 1000 but it leads to the same result. Your solution allows a bigger range of seconds than mine but ...
However, parsing some internal representation and calculating with it is for sure not the way he should go with.Unlike you, I don't disagree with the OP's basic approach but I do question his diagnostic abilities. All the OP had to do was print out the value of the product
Integer.parseInt(callid[1])*1000 and he would have seen exactly what was wrong! There would then have been no need to post this as a problem!

Similar Messages

  • Update file date/time stamp using java

    Let me explain you what I am going through:-
    I have created a java based installer using Jexpress tool and after I do the installation of my files, the files takes the current date rather then taking the date when it was created or modified.
    Everything goes into JAR and I heard that Jar file do not retain the date/time stamp of the file.
    I would like to know if we can change the date and time stamp of the files using Java.
    Is there any method to do that or can we do this by writing the java class?
    Thank You
    Mehul

    Did you check it?
    I did.
    $ jar cvf ~/ui *.m3u
    added manifest
    adding: Amollhgv.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Brand1.m3u(in = 56) (out= 27)(deflated 51%)
    adding: Brand2.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Brand3.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Brand4.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Brand5.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Brand6.m3u(in = 42) (out= 24)(deflated 42%)
    adding: Edurhgv.m3u(in = 42) (out= 24)(deflated 42%)
    $ unzip -l ~/ui
    Archive:  /home/ijbalazs/ui
      Length     Date   Time    Name
            0  12-04-03 17:53   META-INF/
           71  12-04-03 17:53   META-INF/MANIFEST.MF
           42  08-26-02 01:03   Amollhgv.m3u
           56  11-22-98 01:15   Brand1.m3u
           42  08-26-02 01:04   Brand2.m3u
           42  08-26-02 01:04   Brand3.m3u
           42  08-26-02 01:04   Brand4.m3u
           42  08-26-02 01:04   Brand5.m3u
           42  08-26-02 01:04   Brand6.m3u
           42  08-26-02 01:04   Edurhgv.m3u
          421                   10 files

  • FINDING, TIME STAMPING, AND SAVING SELECTED PORTIONS OF WAV FILE

    Hello Everyone,
    LV 6.1
    What I'm trying to do is build an app that
    captures, timestamps and saves peaks only in a *.wav file from the sound card.
    Specifically, dog barking.  My dream would be that I have a constant input
    from a mike into the sound card which LV will real time analyze. When a threshold is triggered
    (a dog bark) the app will save the bark only with a time stamp.  My case against
    my neighbors would be better exemplified is I were able to present them with a
    time-of-day graph with tic marks at each bark and a cd they could listen to of
    the barks only.
    Explorations so far:
      The sound VI's don't have time stamp outputs
      I have searched the knowledge base and found a few apps but came to a dead end with my knowledge
      I have experimented with various waveform analysis vi's but can't find the combo that gives me what I'm looking for
    I can handle the post processing of graphs / spreadsheets but the waveform analysis for capturing the bark is eluding me. If someone could just get me started I could run with it but so far I ain't smart enough.
    Thank You...........

    Hi rscully,
    I think a great starting place is the "Sound Input to File.vi" example found in the Example Finder. Since the output is waveform data, you should be able to extract the timing information from the waveform data. Try using the "Get Waveform Components" function. If that doesn't work for you, you may also want to just grab the time stamp from the system clock with the "Get Date/Time String" function.
    To record the bark, you can perform signal processing to match the bark frequency. The first thing that comes to mind, is to record a bark, analyze the power spectrum to find the peak power at a specific frequency range. Then in your program, you can find the power spectrum for that specific frequency range, and if the peak within that range exceeds a threshold, record the bark and time-stamp. This method should be simple if you have the NI Spectral Measurements Toolkit. See this tutorial.
    Once you have verified that a bark has occurred, you may want to record the previous bark sound data and the post bark sound data. This will ensure that the entire bark is captured in a sound file. I have edited the "Sound Input to File.vi" example to demonstrate this. Please see the attached picture. I hope this helps!
    Mike Lyons
    National Instruments
    http://www.ni.com/devzone
    Attachments:
    record_bark.jpg ‏105 KB

  • Need current data and time stamp in Java mapping

    Hi All,
      I am doing the scenario as file to mail. so here i am using java mappings for sending the file in mail attachment.
      I have done my java mappings and its executed successfully. File is going successfully to third party.
      Business wants date and timestamp in subject line.
    Currently i am using mail subject line as EDI File. 
    But business needs the date and time in the subject line after EDI File as EDI File <yyyymmddhhmm>.
    So my requirement here is adding the date and timestamp.
    Can any one suggest how can write java code to acheive.
    Thanks
    Bhaskar
    Thanks,
    Bhaskar

    Hi Bhaskar,
    >   Business wants date and timestamp in subject line.
    1. Add the import statments at beginning
    import java.util.Date;
    import java.text.SimpleDateFormat;
    2. Add these statments to get timestamp and Concatenate the subject line with string currentdate.
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmm");
    String currentdate = sdf.format(new Date());
    subjectline = subjectline.concat(currentdate);
    Regards,
    Sunil Chandra

  • Time stamps in Java

    Do we have some functions which I can use to implement timestamps in java ?

    There are many...
    simplest you could use System.currentTimeMillis().
    alternately you could use the "Date" clas (which seems to have deprecated in Java 5).
    also, the new Calendar class which deprecates Date can be used to get a variety of formats od the current date and time. havaq look at their docs at http://java.sun.com/j2se/1.5.0/docs/api/java/util/Calendar.html.

  • Time Stamp Error while extracting data from R/3

    Hi,
        We are getting time stamp error while extracting data from R/3.
    To solve this problem we did replication and run RS_TRANSTRU_ACTIVATE_ALL program. still we are facing same problem.
    Please suggest me to solve.
    Thanks
    Subba Rao

    Hi,
    Time stamp error arises when the time stamp of the data source in source  system and target system are different.
    For we have again activate data source in R/3 system using transaction RSA5 or RSA6 and in BI system goto transaction RSDS and replicate the data source.
    You can also find time stamp details for a data source in tables ROOSGEN and ROOSOURCE tables in BI and R/3 system respectively.
    Here are some useful links.
    [R3 016 Time stamp error where is it in BI?;
    [time stamp error in bi7;
    [Timestamp error in BI7;
    Thanks,
    Venu

  • How do i find out the tables (data)effected in a schema after a particular time stamp

    how do i find out the tables (data not structure)effected in a schema after a particular time stamp?
    pls email in [email protected]

    You can't do that. That would be a real security risc.
    /KAj

  • How do i find out the tables effected in a schema after a particular time stamp

    how do i find out the tables effected in a schema after a particular time stamp?
    pls email in [email protected]

    If you are doing a reload every time then you can issue following commands to clear data from cube.
    lmt name to all
    allstat
    clear all from <cubename>prttopvar
    You can wrap above commands in pl sql procedure using dbms_aw.execute package and execute it before cube load starts. Instead of clearing it from whole cube you can clear only from one partition also. Just take a look at clear command in olap DML 10.2 reference.
    Thanks,
    Brijesh
    Edited by: Brijesh Gaur on Aug 10, 2010 6:47 AM

  • How do I find the date and time stamp on pictures?

    How do I find the date and time stamp for my pictures?

    The Photos app will not do this but other apps will. iPhoto has an icon that when tapped with the photo open will show the EXIF information you are looking for. iPhoto is not free but you can purchase it in the App Store.
    There may be other photo apps that provide this information as well.
    PhotoForge2 will show the EXIF data as well as the GPS data if it is available.

  • GetSelectedFields()  for time stamp and user stamp using java api

    using Java API's
    getSelectedFields() returns NULL  value if values presented also, for Time stamp and User stamp
    properties in Flat tables , is there any other alternative way to get the SelectedFields values ?
    Edited by: Vijaya Sekhar Reddy Alla on Mar 19, 2008 3:16 PM

    Well, I can't say I solved the problem, because I got another one afterwards.
    As usually I created a GetFieldListCommand, set its needed attributes and executed it. Then I read all the field properties out:
    FieldProperties[] fieldProp = getFieldListCommand.getFields();
    Afterwards it is possible to do what you want. Using a for-loop.
    for (FieldProperties fp : fieldProperties) {
        UserStampFieldProperties usfp = (UserStampFieldProperties) fp; // <= Cast error
        FieldId[] fieldIDs = usfp.getSelectedFields();
    And this is what I get now:
    Exception in thread "main" java.lang.ClassCastException: com.sap.mdm.schema.fields.FixedWidthTextFieldProperties cannot be cast to com.sap.mdm.schema.fields.UserStampFieldProperties
    Why this happens, I don't know. But it should somehow be solveable.

  • Find record count between two time stamps

    Hi All,
    Problem: My custom table having a datetime column ;
    I want to find records processed between two time stamps.
    say: records between 2010-04-28 10:15:00 and 2010-04-28 12:30:00
    Could you please help me in this.
    Thanks in advance
    Karri

    use To_date function in where column on that Dat_col
    WHERE date_col BETWEEN TO_DATE ('2010-04-28 10:15:00',
    'mm-dd-rrrr hh24:mi:ss')
    AND TO_DATE ('2010-04-28 12:30:00',
    'mm-dd-rrrr hh24:mi:ss')

  • How to do find the difference between two time stamps

    Hi all,
    i have a table with 2 columns called GMT time and Local time . so i need to find difference between these two time stamps.
    i tried like this
    select to_date(GMT_TIME,'yyyy-mm-dd hh24:hi:ss')-to_date(LOCAL_TIME,'yyyy-mm-dd hh24:hi:ss') from date_table
    the result is coming as follows ..
    0.291666666667
    i did not under stand the out put.
    In my table GMT_TIME= 2011-06-26 00:00:00 and LOCAL_TIME=2011-06-25 17:00:00 ..
    please help me how to get exact hours between two dates ..
    Thanks
    Sreedhar

    Hi Sreedhar,
    Your output (0.2916666) has the unit day.
    You should multiply with 24 to get the unit hour.
    select ( to_date(GMT_TIME,'yyyy-mm-dd hh24:hi:ss')-to_date(LOCAL_TIME,'yyyy-mm-dd hh24:hi:ss') ) * 24 from date_table;Rgds,
    Tycho

  • Java time stamp

    Hello All,
    I want to create a TimeStamp Object.
    I was using the constructor
    TimeStamp s = new TimeStamp(2001, 07, 07, 0, 0, 0, 0);
    Problem is that this constructor is now deprecated.
    The new constructor takes a value of type 'long'.
    But I don't know what to put in this long ?
    Can anyone help?
    regards,
    Abhishek.

    I know that new TimeStamp(System.currentTimeMillis()) would work but that is not what I want.
    I do not want the current time.
    I want to create an Time stamp object with the time
    2001/07/07 00:00:00
    regards,
    Abhishek.

  • How to find the time stamp for delata

    Hi Analysts,
    I am loading data from R/3 to InfoProvider(Cube or ODS) with delta update.
    I have seen nodata was loaded to InfoProvider. But data was available at DataSource. then new delta is started. i want to load the last delta again.
    How to see the time stamp of delta?
    How to load that delta data?
    Please help me in this need.
    Hari.

    Dear Srihari,
    if your last delta failed then you can request it again by calling the same delta infopackage again, it will ask for repeat delta (in case last delta has failed), go and run it.
    this way you can have your delta figurs back, and do upload via PSA.
    Hope it helps.

  • Time stamp information in default trace file

    How to check the time stamp in defaulttrace.trc or application.trc files for logs in XI server.
    I have seen following timestamp in above mentioned trace  files. But seem to me, during the shutdown time of server, system put the timestamp in trace file.
    ERROR       gateway shutdown
    TIME        Fri Jun 20 11:01:08 2008
    Except for shutdown time, how the system put the timestamp for other activity of system in the default trace and application trace file??
    Sometime, i need to check the timestamp to get some specific information in default trace file for some system activities.
    is timestamp mentioned in coded form as per following log:
    #1.#36CC34C00F02009B000001B400001FF40004510B33EAB6D3#1215008464352#com.sap.engine.services.rfcengine##com.sap.engine.services.rfcengine.RFCDefaultRequestHand
    ler.handleRequest()#J2EE_GUEST#0##XQA#SAPSYS                          #4869A1FC78690A8DE10000000A2C0AC7#SAPEngine_Application_Thread[impl:3]_51##0#0#Error##P
    lain###java.lang.reflect.InvocationTargetException#
    #1.#36CC34C00F02009B000001B500001FF40004510B33EAB76C#1215008464352#com.sap.engine.services.rfcengine##com.sap.engine.services.rfcengine.RFCDefaultRequestHand
    ler.handleRequest()#J2EE_GUEST#0##XQA#SAPSYS                          #4869A1FC78690A8DE10000000A2C0AC7#SAPEngine_Application_Thread[impl:3]_51##0#0#Error##P
    lain###java.lang.reflect.InvocationTargetException
    Thanks
    Amar

    Hi Amarjit
    The timestamp is noted in unix epoch time (java does use this as well). It is this field:
    #1.#36CC34C00F02009B000001B400001FF40004510B33EAB6D3# 1215008464352 #com.sap.engine.services.rfcengine##com.sap.engine.services.rfcengine.RFCDefaultRequestHand
    ler.handleRequest()#J2EE_GUEST#0##XQA#SAPSYS
    The first 10 digits are seconds since epoch. The last 3 digits are milisecondes. Converted in human readable format: 07/02/2008 16:21:04.352
    [Unix Time|http://en.wikipedia.org/wiki/Unix_time]
    Damn, i remeber having answered this already here in the forums, but i cannot find the thread anymore myself :-(((
    Best regards
    Michael

Maybe you are looking for

  • Installing 10g on Windows XP Pro.

    I very recently downloaded Oracle 10g. I would like to install it on my external USB2 hard drive and be able to access it from both my laptop PC and my desktop PC. I presume installing it from one of my PC's would be straigthforward. But what do I ne

  • I'm trying to re-install iTunes

    But it keeps saying 'Service 'Apple Mobile Device' failed to start. Verify that you have sufficient privilieges to start system servies' what can I do?

  • I can't update my macbook pro from lion 10.7 to mavericks

    I can't update my macbook pro late 2011 from lion 10.7.5 to mavericks, what I do?

  • BAdI /SAPAPO/DM_PO_MNTN - CT_ORDKEY is not populated with the order data for PO Memo

    Dear All, I have done enhancement in the ERP system by adding the customer specific field ZZ_RESWK in structure CIFPUORCUS. This field is filled in the ERP user exit EXIT_SAPLMEAP_001, for the Purchase order (category BF & BG) and PO Memo (Category A

  • J2SDK 1.4.1 and RedHat Linux 8.0

    I've downloaded the latest version of Java SDK (1.4.1_02) in self extracting binary file. After installation I tried to run demo programs like SwingSet2 and Stylepad they run but after a few while crashed and a lot of exceptions appeared on screen. I