Conversion from data to duration

Hi,
I wish to convert a number, in seconds, to a duration.
As follow: convert 289, which is in seconds, to a duration, which would be in minutes and seconds.
289 seconds is 4 minutes 49 seconds, but how can I convert this in numbers?
I also need to convert a full column of many numbers just as this one, how can I quickly convert many numbers like 289 (representing seconds) in a column in a duration?
Thanks a lot in advance to all who can help,
Paul

Hi Contello,
Thanks for your answer!
It would be nice to be able to that automatically when having an entire column of data such as the one I told you about ... How could I do that?
If I tell numbers 289 alone is a duration, it takes it as if it was 289 hours, not seconds!
The only trick I found is to keep it as if it was hours, and then get a new cell next, in which the cell containing 289 is divided by 60 twice. Then it gives me 289 seconds converted in minutes and seconds, 4 min 49.
Quite tricky isn't it?
Is there a more "proper" way to do this?
I really need to apply it to a big crunch of values ... So I need it to be automatic.
Cheers!

Similar Messages

  • Disallowed implicit conversion from data type datetime to data type timestamp

    Received error: [Macromedia][SQLServer JDBC
    Driver][SQLServer]Disallowed implicit conversion from data type
    datetime to data type timestamp, table 'myTbl', column 'duration'.
    Use the CONVERT function to run this query.
    I have a field named duration hh:mm:ss.lll that I am trying
    to insert into MS SQL. DB has field defined as [duration]
    [timestamp] NOT NULL,
    My insert has this: INSERT INTO myTbl( duration) VALUES(
    <cfqueryparam value="2006-05-26 11:12:13"
    cfsqltype="CF_SQL_TIMESTAMP"/> )
    Why does this not work? rrrrrrrrrrrrrr! BTW: also tried with
    seconds as 13.111 which did not work. Does the db duration need to
    be date? I just want to store a duration for the time of a movie...
    10 Q

    quote:
    Originally posted by:
    quiet1
    Received error: [Macromedia][SQLServer JDBC
    Driver][SQLServer]Disallowed implicit conversion from data type
    datetime to data type timestamp, table 'myTbl', column 'duration'.
    Use the CONVERT function to run this query.
    I have a field named duration hh:mm:ss.lll that I am trying
    to insert into MS SQL. DB has field defined as [duration]
    [timestamp] NOT NULL,
    My insert has this: INSERT INTO myTbl( duration) VALUES(
    <cfqueryparam value="2006-05-26 11:12:13"
    cfsqltype="CF_SQL_TIMESTAMP"/> )
    Why does this not work? rrrrrrrrrrrrrr! BTW: also tried with
    seconds as 13.111 which did not work. Does the db duration need to
    be date? I just want to store a duration for the time of a movie...
    10 Q
    Duration as a timestamp? How odd, most people would store it
    as an integer. Or, if you want to build your own string, the syntax
    is {ts 'yyyy-mm-dd hh:mm:ss'}. The seconds might not be required.
    In any event, use createodbcdatetime() for the value you want
    to put into your table.

  • Implicit Conversion from data type sql_variant to datetime is not allowed.

     Getting a odd error. This code was working perfectly before a SQLServer upgrade.
    The linked database is working, I'm able to pull up data from it in separate queries just fine.
    I'm getting the following error.
    Implicit conversion from data type sql_variant to datetime is not allowed. Use the CONVERT function to run this query.
    Invalid column name 'TotalDay'. (.Net SqlClient Data Provider)
    can anyone spot the issue? I've tried sever variations of the same code, but still get the same thing.
    If I put this section in a query by it self it works just fine.
    ( DATEDIFF(ss,
    CONVERT(VARCHAR(10),( SELECT TOP ( 1 )
    TimeDate
    FROM [nav].AcsLog.dbo.EvnLog AS X3
    WHERE UDF2 = E.No_
    AND CONVERT(VARCHAR(10), X3.TimeDate, 101) = CONVERT(VARCHAR(10), @sdate, 101)
    ORDER BY TimeDate ASC
    ),101),
    CONVERT(VARCHAR(10),( SELECT TOP ( 1 )
    TimeDate
    FROM [nav].AcsLog.dbo.EvnLog AS X4
    WHERE UDF2 = E.No_
    AND CONVERT(VARCHAR(10), X4.TimeDate, 101) = CONVERT(VARCHAR(10), @sdate, 101)
    ORDER BY TimeDate DESC
    ),101)) ) AS TotalDayBadge ,

    >ANDCONVERT(VARCHAR(10),X3.TimeDate,101)=CONVERT(VARCHAR(10),@sdate,101)
    It is not a good idea to use string dates for predicates in WHERE clauses.
    Use DATETIME or DATE in predicates.
    If you are not interested in the time part of DATETIME, use DATE datatype.
    Example:
    SELECT CONVERT(DATE, getdate());
    -- 2014-08-25
    Datetime conversions:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Between dates:
    http://www.sqlusa.com/bestpractices2008/between-dates/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Conversion from DATE to TIMESTAMP datatype

    Hello,
    My issue is as follows:
    1. I have one variable of type DATE, which I assign the value of SYSDATE
    mydatevar DATE:= SYSDATE;2. I want to find *"today"*, truncated to DAY
      TRUNC (mydatevar, 'DD')
    TRUNC function returns DATE datatype. So I will receive in point 2 for example *'2010-01-13 00:00:00'*.
    3. I want to assign the value from point 2 to a variable of type TIMESTAMP
      mytimestampvar TIMESTAMP := mydatevar;which implicitly will convert the DATE variable to TIMESTAMP.
    Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".
    Question: How can I convert from DATE to TIMESTAMP keeping hours and minutes zeros?
    Why I need this conversion: I have a table with a column "column1" TIMESTAMP(0) and I would like to take only those rows from the table, where "column1" is in range from today 12 o'clock in the morning till now (whatever hour it is).
    NLS characteristics of the database:
    PARAMETER                           VALUE
    NLS_LANGUAGE                           AMERICAN
    NLS_TERRITORY                   AMERICA
    NLS_CURRENCY     $
    NLS_ISO_CURRENCY                    AMERICA
    NLS_NUMERIC_CHARACTERS     .,
    NLS_CHARACTERSET                    AL32UTF8
    NLS_CALENDAR                            GREGORIAN
    NLS_DATE_FORMAT                    DD-MON-RR
    NLS_DATE_LANGUAGE            AMERICAN
    NLS_SORT     BINARY
    NLS_TIME_FORMAT                     HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT             DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY              $
    NLS_COMP                             BINARY
    NLS_LENGTH_SEMANTICS               BYTE
    NLS_NCHAR_CONV_EXCP             FALSE
    NLS_NCHAR_CHARACTERSET     AL16UTF16
    NLS_RDBMS_VERSION             10.2.0.4.0Session parameters are the same.
    DBTIMEZONE is "+02:00".

    Verdi wrote:
    Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".I don't think you are necessarily losing any information whatsoever. It's probably more of a function of your NLS_TIMESTAMP_FORMAT and NLS_DATE_FORMAT. For example your NLS_DATE_FORMAT could be setup by default for a HH24 (24 hour time) which would report midnight as "00" hours. However, it looks like your NLS_TIMESTAMP_FORMAT is setup with a "HH" format with a meridian indicator which means 12 hours time.
    Your comparisons should be using date/timestamp data types anyways so as long as the input value is converted properly into a date type this shouldn't matter anyways.
    You can see what is actually stored by using the DUMP function:
    SQL> SELECT  DUMP(TO_TIMESTAMP(TO_CHAR(TRUNC(SYSDATE,'DD'),'MM/DD/YYYY HH:MI:SS AM'))) AS TSTAMP
      2  ,       DUMP(TRUNC(SYSDATE,'DD')) AS DT
      3  FROM DUAL
      4  /
    TSTAMP                                                                      DT
    Typ=187 Len=20: 218,7,1,13,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0                  Typ=13 Len=8: 218,7,1,13,0,0,0,0As you can see the TSTAMP and DT store nearly the same values (218,7,1,13), but the TSTAMP has more precision because of fractional seconds.
    HTH!
    Edited by: Centinul on Jan 13, 2010 7:23 AM

  • Conversion from date to number & display a date in a textfield

    I Have 2 issues
    The first one:
    I need to extract the hour from a date variable.
    This is the code I already have:
    NUM_TOT := NUM_TEL + to_number('PROGRAMMINGS1.PRG_START','hh24');
    NUM_TOT & NUM_TEL are number variables,
    PROGRAMMINGS1.PRG_START is a Textfiel with a dateformat. There can only be an houre like 24:59:00 entered.
    So in this example I just want the houre and convert it to a number.
    The second:
    I want to make a date from a few numbers & then display it in a texfield.
    This is the code I already have:
    VAR_DATE := NUM_TEL || ':' || NUM_LENGTH || ':00';
    :PROGRAMMINGS.PRG_END := to_date(VAR_DATE,'hh24:mi:ss');
    Between the 2 lines of code i places a message(VAR_DATE) for testing.
    When the program display VAR_DATE then i can see the good date at the bottom of the screen.
    But when I place my variable in the textfield it looks like: 00:00:00. What am I doing wrong?
    Who can help me.
    With regards
    Stefanie

    Verdi wrote:
    Problem: During the conversion (both implicit and explicit conversion with a format mask) I lose the "00" hours and "00" minutes and receive something like this: "10-JAN-13 *12*.00.00.000000000 AM".I don't think you are necessarily losing any information whatsoever. It's probably more of a function of your NLS_TIMESTAMP_FORMAT and NLS_DATE_FORMAT. For example your NLS_DATE_FORMAT could be setup by default for a HH24 (24 hour time) which would report midnight as "00" hours. However, it looks like your NLS_TIMESTAMP_FORMAT is setup with a "HH" format with a meridian indicator which means 12 hours time.
    Your comparisons should be using date/timestamp data types anyways so as long as the input value is converted properly into a date type this shouldn't matter anyways.
    You can see what is actually stored by using the DUMP function:
    SQL> SELECT  DUMP(TO_TIMESTAMP(TO_CHAR(TRUNC(SYSDATE,'DD'),'MM/DD/YYYY HH:MI:SS AM'))) AS TSTAMP
      2  ,       DUMP(TRUNC(SYSDATE,'DD')) AS DT
      3  FROM DUAL
      4  /
    TSTAMP                                                                      DT
    Typ=187 Len=20: 218,7,1,13,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0                  Typ=13 Len=8: 218,7,1,13,0,0,0,0As you can see the TSTAMP and DT store nearly the same values (218,7,1,13), but the TSTAMP has more precision because of fractional seconds.
    HTH!
    Edited by: Centinul on Jan 13, 2010 7:23 AM

  • Conversion from Date to say Locale time

    Hello All,
    I receive a date in xml file as a string. eg 01/27/2004 . I have to convert it to Locale format(2005-01-10T12:30-04:10) using XSL. Is it possible ?. If yes how to do that ?.
    Thanks and regards,
    Sachin

    Hello All,
    I am very sorry for framing the question wrongly. Actually I have recieved the date and time from xml which I will concat and store it in <xsl:variable>. Now I want to do processing on the variable using Java. Is it possble to do so ?. Means can I call some java function and pass the variable to the function do the processing on the variable and return the output and save that output in some variable which can be displayed.
    Thanks in advance.
    Waiting for reply.

  • Conversion from string "20041023 " to type 'Date' is not valid.

    Hi ,
       I have a table with one of the column(EmpHiredate) datatype is char(10). It has value like "20141023". I need to display this value as date format(dd/mm/yyyy) in report. 
    Following methods i tried in textbox expression but no luck.
    =Format(Fields!EmpHireDate.Value,"dd/MM/yyyy")
    =Cdate(Fields!EmpHireDate.Value)
    Error:
    [rsRuntimeErrorInExpression] The Value expression for the textrun ‘EmpHireDate.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string "20041023  " to type 'Date' is not valid.
    Is it possible to convert string to date using SSRS textbox expression ? Can anyone help me with the solution.
    Thanks,
    Kittu

    Hi Jmcmullen,
         Found one more issue on the same. I have one value like "00000000" for the column(EmpHiredate)
    , when i use above expression values(ex:"20141023")
    are displaying in dd/MM/yyyy format in report except value like "00000000" and giving following error:
    [rsRuntimeErrorInExpression] The Value expression for the textrun ‘EmpHireDate.Paragraphs[0].TextRuns[0]’ contains an error: Conversion from string "0000/00/00" to type 'Date' is not valid.
    Even i tried to pass its original value("00000000") as below but no luck.
    =IIF(Fields!EmpHireDate.Value = "00000000","00000000",Format(CDATE(MID(Fields!EmpHireDate.Value,1,4) + "/" + MID(Fields!EmpHireDate.Value,5,2) + "/" + MID(Fields!EmpHireDate.Value,7,2)),"dd/MM/yyyy"))
    Also tried this:
    =IIF(Fields!EmpHireDate.Value = "00000000","2000/10/21",Format(CDATE(MID(Fields!EmpHireDate.Value,1,4) + "/" + MID(Fields!EmpHireDate.Value,5,2) + "/" + MID(Fields!EmpHireDate.Value,7,2)),"dd/MM/yyyy"))
    Please Suggest. 
    Thanks ,
    Kittu

  • Date/time conversion from UTC to CET

    Hello,
    Jjust a little question to our SAP BI community!
    Is there a BI function/ggod way that converts a (datetime) string DDMMYYYYHH:MM:SS  in UTC time zone into a string DDMMYYYYHH:MM:SS in  CET timezone ?
    We receive this string in input in a flat file and need it to convert from UTC to CET.
    Or do you know any way to convert a date/time from IUTC to CET, eveen using an ABAP function?
    Thanks a lot,
    Matthieu

    Hi,
    Check this thread for time conversion from UTC to Local time
    [ABAP statement for converting UTC date/ time to local date/time],
    Regards,
    Daya Sagar

  • Conversion from milliseconds to Date in 1.5

    A java.util.Date object can be constructed by passing the number of milliseconds since 1 January 1970 as a constructor argument. This Date can then be formatted to a human-readable format with SimpleDateFormat.
    I have tested this conversion from milliseconds to a date both in Java SDK 1.4.1 and Java 1.5.0 to see if there are differences in the way dates are calculated from milliseconds. It seems that there are differences when the system timezone is set to Europe/Berlin. The dates from 1.5.0 are one hour ahead of those from 1.4.1 in a certain week in May 1945 and a day in September 1945.
    This means that milliseconds that are generated from a date by using the Java 1.4.1 runtime and then stored are interpreted differently when they are retrieved when using java runtime 1.5.0, if they happen to be one of those days in 1945. This could cause discrepancies when an application is migrated to JDK 1.5.0.
    This is only a minor problem, but is there any way to know what caused these changes in SDK 1.5.0 and what these changes are? Is there historical data that the Sun implementation is based on to calculate dates from millisecond values?
    Any help is appreciated.
    Kind regards

    I found the following at "http://thedailywtf.com/forums/70146/ShowPost.aspx"
    In summer 1945, Berlin and the Soviet-occupied part of Germany observed a daylight savings time of two hours. Unfortunately, Sun's JRE 1.4 implementation of GregorianCalendar defines a maximum DST of one hour and, in non-lenient mode, rejects the 2 hours as invalid when recalculating all fields after the millisecond field is set.
    Here's the bug report: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4639407

  • How to Calculate Duration from Date Columns

    Hello,
    I would like to calculate duration from date columns. Using the following query
    SELECT DISTINCT
    EVENT_ID,
    To_Char(RU.START_TIME, 'HH24:MI') START_TIME,
    To_Char(RU.END_TIME, 'HH24:MI') END_TIME
    FROM ROOM_USAGE RU
    What I need is to subtract START_TIME from END_TIME and result should be in minutes.
    Many Thanks,

    But, i think you need to calculate the number of days if the days are not same -
    satyaki>
    satyaki>
    satyaki>
    satyaki>with ru
    2 as
    3 (
    4 select '05-JAN-2007 15:10:20' start_time, '07-JAN-2007 19:20:20' end_time from dual
    5 union all
    6 select '08-JAN-2007 05:10:20' start_time, '07-JAN-2007 07:07:20' end_time from dual
    7 )
    8 select ru.start_time, ru.end_time, SUBSTR(numtodsinterval(to_date(RU.END_TIME,'DD-MON-YYYY HH24:MI:SS')-to_date(RU.START_TIME,'DD-MON-YYYY HH24:MI:SS'), 'DAY'), 12, 8) duration
    9 from ru;
    START_TIME END_TIME DURATION
    05-JAN-2007 15:10:20 07-JAN-2007 19:20:20 04:09:59
    08-JAN-2007 05:10:20 07-JAN-2007 07:07:20 22:03:00
    satyaki>
    Or, Am i missing anything?
    Regards.
    Satyaki De.
    is it possible to to add the duration? making the total hours to 26:12 (twentysix hours and twelve minutes)

  • How do i do data conversion from 11.0.3 to 11.5.10?

    Hi to all,
    If any body have any approach how to do data conversion from 11.0.3 to 11.5.10 release?
    Thanx in Advance

    ajones2 wrote:
    I got the update to work but there seems to be one thing that does not work
    I'm anxious to install 4.5 as well because I understand the music player features a sound equalizer, but I believe it's not prudent to get it from somewhere other than your carrier.  I could be wrong, but I think that each carrier tweaks the OS in some fashion...
    Does your 4.5 have the sound equalizer ?
    George from Bedford, TX
    8120 on T-Mobile with BB Unlimited Email+Internet but
    without the BlackBerry Enterprise service

  • Data conversion from I32 to U8

    Hello,
    I have Data in I-32 ( 1D-Array 32 Bit)  and I want to convert it into U8 ( 1D-Array 8 Byte) how I can doing that with Labview? 
    BR

    Hello, I have Lin Communication with RS232. At first I have Data with RS232-Write sent data [85.,125,23,2,39,5,255,255,255,255,186] so the Input ist a string in ASCII- Form. Data to send is 8 bit Integer so I convert the data at firt to I-32 then I use Convert number to Hexdecimal string.
    With RS232 I try to get the answer, But the output string[553c17022705FFFF] so I try to to make from this string an Array [55,3C,17,02,27,05,FF,FF] and then I convert it with Hexdecimal string convert to Number in I32, then to U8 because, with data to rec and massage fram is in U8.
    My problem is: to get the Data rec I have to use the Array-Subset where is the the array is the massage frame and the index is the message size from Data to send  + 1 = 12 .
    My resut in data rec is array with only the first value[55,3C,0,0,0,0,...] and the other value is zero.
    So i don´t know wher ist the error? Can you help me
    The result in the Frontpanel is:
    Message_Frame: 55,7d,BA,55,7D,55,FF,FF,0,0,0
    Data_rec is: 55,7D,0,0,0,0,0,0,0,0,
    I think I have problem with convert but i can not see the erorr

  • Error while loading : Time conversion from 0CALDAY to 0FISCPER

    Hi ,
           I get the following error when loading to an ODs .
    My 0FISCPER is mapped to one of the date fields from the extractor (Document date) and also Have 0FISCVARNT as part of data fields  .
    " Time conversion from 0CALDAY to 0FISCPER (fiscal year ) failed with value 20060405 " .
    thanks .

    Hello CG
    Please refere this forum
    Time conversion problem
    Thanks
    Chandran

  • FM for Material number conversion from R/3 to APO in R/3

    Hi,
       Can anybody tell me conversion exit (function module) for Material number conversion from R/3 to APO in R/3 system. I mean i have 18 digit R/3 material number which i have to convert to 40 digit APO material number in R/3 system.
    Please suggest to win full points.
    Thaniks in Advance,
    Chandan Dubey

    Dear Chandan,
    Conversion Exits:
    CONVERSION_EXIT_MATN1_INPUT ....... If you are storing Material With Zeros
    Then concatenate it with 22 zeros. i.e. '0000000000000000000000000000'.
    For example:
    data : v_matnr type matnr,            "R/3 Material
           v_apo_matnr(40) type c,        "APO Material with 40 length
           v_zeros(22) type c. value '0000000000000000000000000000'.
    CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
           EXPORTING  INPUT          = v_matnr
           IMPORTING  OUTPUT         = v_matnr.
    concatenate e_mantr v_zeros into
                v_apo_matnr.
    Regards,
    Naveen.

  • Supplier Conversion - Sites data - Country code

    Hi,
    While doing Supplier conversion from release 11.5.10 to R12.1.3, we see the below value in REJECT_LOOKUP_CODE column of the AP.AP_SUPPLIER_INT_REJECTIONS table:
    'AP_NULL_COUNTRY_NAME'
    As I understand this looks like the program is looking for a Country code. The country code column is a Nullable column in the AP_SUPPLIER_SITES_INT table, so not sure where validation happening. In 11i data, there are records that do not have the Country code set up and we are tying to bring those in to R12. Any one faced this issue, any ideas / work-around?
    Is the program validating the data against any seeded lookups in oracle apps?
    Thanks,
    gg.

    Hi Vidhu,
    Every supplier will have a site meant for different purposes ... at the backend they are stored in AP_SUPPLIER_SITES_ALL table ...
    If you query this table, you can find the list of supplier sites that are enabled for Purchase Site assignment and Payment Sites assignment ....
    i.e.
    Select VENDOR_ID, VENDOR_SITE_ID, ORG_ID, PURCHASING_SITE_FLAG, PAY_SITE_FLAG from AP_SUPPLIER_SITES_ALL
    From Vendor ID you can find the supplier name and number from AP_SUPPLIERS table
    From Vendor Site ID you can find the supplier site name from AP_SUPPLIER_SITES_ALL table
    From ORG_ID you can find the operating unit name from HR_OPERATING_UNITS
    I would recommend enabling the Pay_site_flag for the supplier sites that are enabled for Purchase site flag and assigned to operating unit already .....
    Since you cannot create Invoice for a supplier site, if the site is not enabled for Pay_Site_flag, and you cannot create purchase order for a supplier site, if the site is not enabled for Purchasing_site_flag... hence from business perspective they need a site in every operating unit which is enabled for Pay_site_flag and Purchasing_site_flag ...
    Regards,
    Ivruksha

Maybe you are looking for