Converting a time from hhh:mm:ss

I've used SimpleDate before, but I can't seem to make this work. I have results of login times for an entire month given as hours:minutes:seconds. I need to convert this to a long so I can manipulate the results acordingly. My problem is that the hours from my statistics are given in three hour place holders (Ex: 126:21:32), so I'm not sure what to use for the SimpleDateFormat constructor. Any advice would be good.
Thanks

Something along these lines?
public static void main (String[] args)
    try
        SimpleDateFormat format = new SimpleDateFormat("hhh:mm:ss");
        System.out.println(format.parse("126:21:32").getTime()
           - format.parse("000:00:00").getTime());
    catch(Exception e)
        e.printStackTrace();
}

Similar Messages

  • How convert date/time from xml in xdp(Designer)?

    Hi, i want to convert date/time format from xml in Designer, date/time value in xml is NOT in common format YYYY-MM-DD (if is in a common format i can do this with pattern)
    I have a "DateTime" Field in Xdp can get from Xml date and time:
    In XML <DateTime>DD-MM-YYYY</DateTime> i want to convert in XDP in DateTime Field in "DD-April-YYYY"
    Can i do this?

    You can do this way..
    Bind the date field to your XML tag.
    Set the display pattern for the date field.
    In the initialize event of the date field place the following code.
    Set JavaScript as language.
    var dtStr = this.rawValue;
    var pos1=dtStr.indexOf("-");
    var pos2=dtStr.indexOf("-",pos1+1);
    var strMonth=dtStr.substring(0,pos1);
    var strDay=dtStr.substring(pos1+1,pos2);
    var strYear=dtStr.substring(pos2+1);
    //Assign the formatted value to the Date field.
    this.rawValue = strYear + "-" + strMonth + "-" + strDay;
    Thanks
    Srini

  • How do I convert time from hours and minutes to decimal time

    I am making a spread sheet a work for payroll. I need to make a formula that converts the time from hours and minutes to decimal time. Please help

    Hi Taryn,
    I can't see much from the photo, but I assume your formula is similar to the one I've used below:
    The same formula is used in F4 and F6, and both return the same result (shown in F4).
    F4 was left on "automatic" cell format, and the column widened to accomodate the repeating decimal to the point where Numbers would begin displaying zeros.
    F6 was formatted as shown in the Cell Inspector to show only two decimal places.
    Neither of these is an "exact" decimal, as it is not possible to use a decimal fraction to "exactly" represent 1/6 (or 10/60).
    The likely reasons for yours showing a whole number of hours is a difference between your formula and the one shown in the example here, or a difference in the number of decimal places set in the cell's format.
    Regards,
    Barry
    PS: To take a screen shot:
    Place the mouse pointer at the top left corner of the area you want to nclude in the shot.
    Press shift-command-4.
    Use the mouse to drag a selection rectangle contining the part of the screen you want to include.
    Release the mouse button. (You'll hear the sound of a camera shutter 'snapping' the picture.)
    The screen shot will be saved to your desktop with the name 'screen shot' followed by the date and time.
    The image may be posted to the discussion using the same steps you used to post the photo above.
    B.

  • Function Module To Change TIME from GMT to CST

    Hello All,
    Can anyone tell me if there is any Function Module to convert the TIME from GMT to CST?
    Regards

    Hi Sunil,
    use the following code.
    DATA :
      timestamp like TZONREF-TSTAMPS,
      time      like sy-uzeit,
      date      like sy-datum.
    The following function module is used to convert the
    time and date into GMT timestamp
    CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
      EXPORTING
        i_datlo           = sy-datum
        i_timlo           = sy-uzeit
        I_TZONE           = 'INDIA'
    IMPORTING
       E_TIMESTAMP       = timestamp.
    The following function module is used to convert the
    above obtained timestamp to PST timezone date and time.
    CALL FUNCTION 'IB_CONVERT_FROM_TIMESTAMP'
      EXPORTING
        i_timestamp       = timestamp
        I_TZONE           = 'CST'
    IMPORTING
        E_DATLO           = date
        E_TIMLO           = time.
    write :/ 'Date and Time at PST zone is ',date, time.
    Reward if helpful.
    Thanks,
    Naveen.

  • Conversion failed when converting date and/or time from character string

    Hi experts,
    I'm trying running a query in Microsoft Query but it gives the following error message:
    "conversion failed when converting date and/or time from character string"
    when asks me the data I'm inserting 31-01-2014
    i've copy the query form the forum:
    SELECT T1.CardCode, T1.CardName, T1.CreditLine, T0.RefDate, T0.Ref1 'Document Number',
         CASE  WHEN T0.TransType=13 THEN 'Invoice'
              WHEN T0.TransType=14 THEN 'Credit Note'
              WHEN T0.TransType=30 THEN 'Journal'
              WHEN T0.TransType=24 THEN 'Receipt'
              END AS 'Document Type',
         T0.DueDate, (T0.Debit- T0.Credit) 'Balance'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')<=-1),0) 'Future'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=0 and DateDiff(day, T0.DueDate,'[%1]')<=30),0) 'Current'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>30 and DateDiff(day, T0.DueDate,'[%1]')<=60),0) '31-60 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>60 and DateDiff(day, T0.DueDate,'[%1]')<=90),0) '61-90 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>90 and DateDiff(day, T0.DueDate,'[%1]')<=120),0) '91-120 Days'
         ,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=121),0) '121+ Days'
    FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
    WHERE (T0.MthDate IS NULL OR T0.MthDate > ?) AND T0.RefDate <= ? AND T1.CardType = 'C'
    ORDER BY T1.CardCode, T0.DueDate, T0.Ref1

    Hi,
    The above error appears due to date format is differnt from SAP query generator and SQL server.
    So you need convert all date in above query to SQL server required format.
    Try to convert..let me know if not possible.
    Thanks & Regards,
    Nagarajan

  • Error "Conversion failed when converting date and/or time from character string" to execute one query in sql 2008 r2, run ok in 2005.

    I have  a table-valued function that run in sql 2005 and when try to execute in sql 2008 r2, return the next "Conversion failed when converting date and/or time from character string".
    USE [Runtime]
    GO
    /****** Object:  UserDefinedFunction [dbo].[f_Pinto_Graf_P_Opt]    Script Date: 06/11/2013 08:47:47 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE   FUNCTION [dbo].[f_Pinto_Graf_P_Opt] (@fechaInicio datetime, @fechaFin datetime)  
    -- Declaramos la tabla "@Produc_Opt" que será devuelta por la funcion
    RETURNS @Produc_Opt table ( Hora datetime,NSACOS int, NSACOS_opt int)
    AS  
    BEGIN 
    -- Crea el Cursor
    DECLARE cursorHora CURSOR
    READ_ONLY
    FOR SELECT DateTime, Value FROM f_PP_Graficas ('Pinto_CON_SACOS',@fechaInicio, @fechaFin,'Pinto_PRODUCTO')
    -- Declaracion de variables locales
    DECLARE @produc_opt_hora int
    DECLARE @produc_opt_parc int
    DECLARE @nsacos int
    DECLARE @time_parc datetime
    -- Inicializamos VARIABLES
    SET @produc_opt_hora = (SELECT * FROM f_Valor (@fechaFin,'Pinto_PRODUC_OPT'))
    -- Abre y se crea el conjunto del cursor
    OPEN cursorHora
    -- Comenzamos los calculos 
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    /************  BUCLE WHILE QUE SE VA A MOVER A TRAVES DEL CURSOR  ************/
    WHILE (@@fetch_status <> -1)
    BEGIN
    IF (@@fetch_status = -2)
    BEGIN
    -- Terminamos la ejecucion 
    BREAK
    END
    -- REALIZAMOS CÁLCULOS
    SET @produc_opt_parc = (SELECT dbo.f_P_Opt_Parc (@fechaInicio,@time_parc,@produc_opt_hora))
    -- INSERTAMOS VALORES EN LA TABLA
    INSERT @Produc_Opt VALUES (@time_parc,@nsacos, @produc_opt_parc)
    -- Avanzamos el cursor
    FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
    END
    /************  FIN DEL BUCLE QUE SE MUEVE A TRAVES DEL CURSOR  ***************/
    -- Cerramos el cursor
    CLOSE cursorHora
    -- Liberamos  los cursores
    DEALLOCATE cursorHora
    RETURN 
    END

    You can search the forums for that error message and find previous discussions - they all boil down to the same problem.  Somewhere in your query that calls this function, the code invoked implicitly converts from string to date/datetime.  In general,
    this works in any version of sql server if the runtime settings are correct for the format of the string data.  The fact that it works in one server and not in another server suggests that the query executes with different settings - and I'll assume for
    the moment that the format of the data involved in this conversion is consistent within the database/resultset and consistent between the 2 servers. 
    I suggest you read Tibor's guide to the datetime datatype (via the link to his site below) first - then go find the actual code that performs this conversion.  It may not be in the function you posted, since that function also executes other functions. 
    You also did not post the query that calls this function, so this function may not, in fact, be the source of the problem at all. 
    Tibor's site

  • How to convert the date time from MM-DD-YYYThh:mm:ss to YYYY-MM-DDThh:mm:ss format

    Hi All,
    I have a requirement in my project like to convert the date time from one format to another.my situation is like to convert the date time from MM-DD-YYYThh:mm:ss to YYYY-MM-DDThh:mm:ss format. I am using the soa suite 11.1.1.6.
    Can any one suggest me how to convert in the BPEL transformation.
    Thanks,
    Sanju.

    Hi Sanju,
    Store the date to be converted into a variable viz. dateVar. Now, process an expression in assign as: xp20:format-dateTime($dateVar,'[Y0001]-[M01]-[D01] [h]:[m01]:[s01]').
    Regards

  • SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)

    SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.  'Received Alerts' (OAIB)
    SELECT    
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO AS T0 LEFT OUTER JOIN
                          VPM2 AS T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
         OVPM AS T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1 AS T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate>='[%0]' and T0.DocDate<='[%1]'

    Hi,
    Try this:
    SELECT   
    CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
    WHEN T0.DocStatus = 'C' THEN 'CLOSED'  END  AS 'Document Status',
    T0.DocDate AS 'Posting Date',
    T0.DocNum AS 'Doc.No',
    T0.NumAtCard,
    T0.TransId AS 'Trans. No.',
    T0.Comments AS 'Remarks',
    T0.CardCode AS 'Offset Acct',
    T0.CardName AS 'Offset Acct Name',
    sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
    T3.DueDate AS 'Cheque Date',
    T3.CheckSum AS 'Amount'
    FROM         ODPO  T0 LEFT OUTER JOIN
                          VPM2  T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry
    LEFT OUTER JOIN
         OVPM  T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
                          VPM1  T3 ON T2.DocEntry = T3.DocNum
    where T0.DocDate >= '[%0]' and T0.DocDate <='[%1]'
    group by T0.DocStatus,T0.DocDate ,
    T0.DocNum ,
    T0.NumAtCard,
    T0.TransId ,
    T0.Comments ,
    T0.CardCode,
    T0.CardName ,
    T0.WTSum ,
    T3.DueDate ,
    T3.CheckSum
    Thanks & Regards,
    Nagarajan

  • How to convert time from (hh:mm:ss) to (hhmmss) in CSV file

    Hi Experts,
    I have a CSV file where there is time column which displays time like hh:mm:ss
    But the input I should give for loading the data is hhmmss
    The amount of records that I have is more than 2 lakhs. I tried many ways to convert the time but I'm unsuccessful.
    Can anyone tell me how do I convert the format please.
    Thanks

    Hi,
    You can create a custom infoobject length 6 (say mytime) to read the data from csv file.
    In the field routine assign the 6 character length info object to the required time IO(system time) with routine.
    Inside the field routine...
    result = source_fields-mytime.
    The system will take care of conversion as per the user master setting.
    Thanks,
    Jugal.

  • Fm to convert time from 12 hour to 24 hour format?

    Hi Gurus,
    Can you please tell me the Funtion module for converting time from 12 to 24 hour format and how to use that, kindly provide some test data too.
    THanks and Regards
    Sudipto

    Hi,
    You can use FM HRVE_CONVERT_TIME to convert time to 24 hour format.
    Pass B in TYPE_TIME parameter and time you wish to convert to along with AM/PM in INPUT_AM_PM parameter.
    Regards,
    Ni3

  • Convert time from digits to words

    Hi,
    Is there a built-in or freely available actionscript function
    that would convert time from digits to words. For example, "9:30"
    becomes "half past nine"?
    Thanks!

    oops, missed the requirement for numbers as words, added that
    in:
    edit: fixed '1 minutes past' changed to '1 minute past'
    edit2:clarity with Number type on hour

  • Convert time from ist to gmt

    The time captured on Image by Camera is in IST.
    how to convert the time of image to GMT

    ashwiniashtikar wrote:
    thanks for the answer
    can you send me the java codeIt's just three flippin lines of code. One to create the SimpleDateFormat instance for which you will have to define the format since I don't know it. One line to set the Timezone. One line to call the parse() method. The Javadoc gives the detail.
    If you can't write these three lines then I suggest you choose a more appropriate career. Maybe behind the counter at McDonnalds.

  • How can i convert video files from my mac to watch them on my iphone?, how can i convert video files to watch them on my iphone?

    how can i convert video files from my mac to watch them on my iphone?, how can i convert video files to watch them on my iphone?

    Turns out the answer to that question changes if you ask it more than 4 times, so ask it again....
    The answer depends on the type of video files you want to convert.  If they are DRM protected commercial videos, no help can be given here.  Google.

  • Hi everyone, I have LR 5 that I purchased with a serial number and about a week ago I got the message about a new update, I want to get LR 6 but not the creative cloud, last time from LR4 to LR5 there was just an update without buying the creative cloud,

    Hi everyone, I have LR 5 that I purchased with a serial number and about a week ago I got the message about a new update, I want to get LR 6 but not the creative cloud, last time from LR4 to LR5 there was just an update without buying the creative cloud, is that possible from LR5 to LR6? Thanks so much.

    Welcome to Apple Discussions!
    You can't install 9.2.1 or earlier on any Mac that is only Mac OS X bootable. In fact you need to use the restore disks which came with those Macs to install 9.2.2 on those Macs. 8.6 is only possible to install on Macs which came with 8.6 or earlier. The 9.1 disk may be useful for your 1999 PowerMac G4, but won't be of any use for a 2006 Powerbook G4.
    Adobe Pagemill does not follow w3.org web publishing standards. If you want a webpage editor, get http://www.barebones.com/ BBEdit
    MS Office, there is a free Mac OS X alternative in http://www.neooffice.org/
    Or you can upgrade to the full Office 2004 for the Mac, or get http://www.thinkfree.com/ or Open OS X Office.
    Wordperfect files can be converted to Word files with http://www.dataviz.com/ 's Maclinkplus.
    Microsoft no longer has Internet Explorer for download (that quit being offered January 2006), though that is covered more in my FAQ:
    http://www.macmaps.com/browser.html
    As for other Mac OS X inquiries, I strongly recommend seeing my other FAQ:
    http://www.macmaps.com/macosxnative.html
    which should answer most of your other questions. If you have further questions, please feel free to ask me.
    Disclaimer: Reference to links I make to my Macmaps.com website are a for your information only type reference. I do not get any profit from this page, and it is open to the public.

  • When I converted a file from PDF to WORD.DOC it opened as Read Only and I'm unable to alter any of the text.  How can I solve this problem?

    When I tried to convert a file from PDF to WORD.DOC it opened as Read Only and I'm unable to alter any of the text.  How do I solve this problem?  I don't know how to change it from Read Only.

    Dear Sara
    Thank you very much for sending the converted file.  Yes, I am able to edit it - that will be very useful to me and I appreciate your help.
    Referring to your previous message when you said you'd converted via Acrobat and not Acrobat.com, I'm converting via Acrobat.com because that's the only option that is shown (how do I convert via Acrobat? - perhaps that would be more successful).  I'm using the Export PDF website, and the OCR is enabled to "Recognize text in English UK".  However, I've just tried converting a different LPA pdf form, this time for Health & Welfare https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/245571/LPA114_He alth_welfare_LPA.pdf and again I have the same problem as before.  I've altered it from "Read only" and thought I'd then be able to enter text, but "Drawing Tools" is shown in the pane and I'm unable to enter anything onto the form - everything appears to be in images.  Also, the lettering on the heading of' page 1 has become jumbled, with the word "Public" overlaying the word "Guardian."  Any suggestions as to what it is I'm doing wrong would be welcome - I don't like to be beaten!
    Regards,
    Judith.

Maybe you are looking for

  • Safari launches but won't open a window

    I'd set up Safari for my son under his own profile and it was working great with Parental Controls. When I went in one day to update his allowed sites, Safari launched but wouldn't open a window.  I could access preferences, reset, etc., but it would

  • Script no longer working with OS 10.5

    Since I have upgraded to 10.5 a few weeks ago the following script no longer is working properly. I had been using this script extensively over the last two without any problems. Now it seems to hang up when it gets to the "duplicate item i of photoL

  • Third Party Billing Plan Invoice problem

    I have an issue in regards to using milestone billing with a third party order.. We currently use third party ordering to ship goods direct to our customers from our parent company in France. This process works well. I know have a scenario where our

  • Macbook screen fades

    HI All, I have a new unibody macbook. Periodically the screen fades to almost black (like it goes before starting front row). It doesn't seem to be related to key combinations or whether powered/ on battery. It is still awake and some period later (u

  • Remedy CMDB Integration with SCCM 2012

    We are facing an issue with duplicate entries of Hostname after remedy is integrated with SCCM2012.We have created custom view in SQL database which mapped to remedy database.Below is the query used for the integration.Can I get any help on this? SEL