Convert time

Hi guyz,

I imported data from Microsoft Access in Oracle where some time field is display as 210539 as time I want to convert this time in format IE property (21:05:39 HH24MISS), but when I use the below query showing error something wrong with my request? I have

SQL> SELECT TO_CHAR(101550,'HH24:MI:SS')FROM DUAL;
SELECT TO_CHAR(101550,'HH24:MI:SS')FROM DUAL

*

ERROR on line 1:

ORA-01481: invalid number format model

I use oracle 10g.

You try to convert a number to a string, using a mask of datetime - this is not allowed.  Use 'HH', the value to convert to a datetime type.

for example, this will work:

SELECT TO_CHAR (to_date ('101550', 'HH24MISS'), 'HH24:MI:SS') FROM DUAL

.. because now we are told Oracle that 101550 is actually a DateTime in the format 'HH24MISS '.

Tags: Business Intelligence

Similar Questions

  • How to convert times from second to hh with CVI

    How to convert times from second to hh with CVI?

    Can anyone advice?

    It's here. As I told you, it's very simple:

    //----------------------------------------------------------------------
    // Function secToHMSstring ()
    //----------------------------------------------------------------------
    /// HIFN secToHMSstring ()
    /// HIFN The function takes an amount of seconds and returns a string with
    /// HIFN the corresponding value in H:M:S format
    /// HIPAR sec/Value in seconds to convert
    /// HIPAR verbose/If True use "hms" separators; if not, use ":" separator
    /// HIPAR string/The output string. It is responsibility of the programmer
    /// HIPAR string/that the string is large enough to keep the resulting text
    /// OUT string
    void secToHMSstring (int sec, int verbose, char *string)
    
    {
        int     hh = 0, mm = 0, ss = 0;
    
        if (sec >= 3600) {
            hh = sec / 3600;
            sec -= hh * 3600;
        }
        if (sec >= 60)
            mm = sec / 60;
        ss = sec - mm * 60;
    
        strcpy (string, "");
        if (verbose) {
            if (hh > 0) sprintf (string, "%s%dh", string, hh);
            if (mm > 0) { if (strlen (string)) strcat (string, " "); sprintf (string, "%s%dm", string, mm); }
            if (ss > 0) { if (strlen (string)) strcat (string, " "); sprintf (string, "%s%ds", string, ss); }
        }
        else {
            if (hh > 0) sprintf (string, "%s%d:", string, hh);
            if (mm > 0) {
                if (strlen (string)) sprintf (string, "%s%02d:", string, mm); else sprintf (string, "%d:", mm);
            }
            else if (strlen (string))
                strcat (string, "00:");
            if (strlen (string)) sprintf (string, "%s%02d",  string, ss); else sprintf (string, "%d", ss);
        }
    
        return;
    }
    
  • Convert time GMT AEST(australian timing) in SQL

    I once solved based on the field. How to convert time resolved GMT WAS in where condition?

    Hi Gayathri Venugopal,

    Gayathri Venugopal wrote:

    I once solved based on the field. How to convert time resolved GMT WAS in where condition?

    You can do something like this:

    select from_tz(to_timestamp('2015-08-18 11:30:05','yyyy-mm-dd hh24:mi:ss'), 'UTC')
    at time zone 'Australia/West' from dual
    

    OR

    select from_tz(to_timestamp('2015-08-18 11:30:05','yyyy-mm-dd hh24:mi:ss'), 'UTC')
    at time zone 'Australia/Melbourne' from dual
    

    Don't know your data/settings NLS session, so it would not be a perfect solution, I guess.

    In addition, this issue concerns mainly SQL if you can post in the appropriate forum: SQL

    I hope this helps!

    Kind regards

    Kiran

  • How to convert 'time' readable value?

    When I print just a playlist of iTunes directly on my printer, the time taken by each song fate of easily readable as way for example: 03:27 or 03:08 (minutes and seconds). Choice of the paper version iTunes does not unfortunately for our situation (a dance group need more songs on one page for the program of dances to play each week that would take on one of the pages in the iTunes of a print to the list). I learned how to export the play list in a text file and load to Microsoft Excel (which allows to print more lines per page), but the time taken by each song comes out as just a number (for example, 207 and 188 for the examples only). These values are to be a constant percentage of minutes + seconds digits. It should be possible to convert. But how? It is not among the options provided by Excel when loading a text file.

    I'd hate to convert each hand!

    Thank you.

    P.S. I have a Mac Mini, as indicated below, but the problems that I have described are spend on my Windows 7 PC.

    Rather than address the export, it would be easier to simply copy (from view songs in your iTunes library) and Paste into Excel.

    So if you have this in your library:

    .. .you will get this in Excel:

    Note that the time of stay in the format mm: SS .

  • Convert time in digital channel display format in a script

    I am trying to convert the display format of a string that contains the time values (mm/dd/yyyy hh:nn:ss.ffff) of time digital. I know I can do this in the Properties section of the data portal, but I want to do in a script. I want to be able to convert it automatically without having to do it manually every time I have import new data. Which syntax is necessary for this?

    I already tried the commands ChnPropSet (and ChnPropValSet), but it does not change the display format after that I executed the script. Thanks for your help.

    Data.Root.ChannelGroups (1). Channels ("time"). Properties ("DisplayType"). Value = "time".
    Data.Root.ChannelGroups (1). Channels ("time"). Properties ("DisplayType"). Value = "digital."

    For me the two lines run to the type. Be aware that the property is the name of "displaytype" not localized user interface.

    You can determine the name of a property of drag and drop in the DIAdem script editor.

  • Convert time in string

    What is the way the more efficienct to convert a time stamp control to a string of DD/MM/YYYY? I'll use its output as parameters to date in a WHERE clause of a SQL Server query.

    Date/time format string is a simple option.

  • Convert time string hh: mm: its corresponding long value.

    Hi all

    I want to convert hh: mmtime S to its corresponding values long chain, I also searched supportforums messages but not a post is close to my question how do you please explain... Thanks in advance.

    http://www.BlackBerry.com/developers/docs/7.1.0api/java/lang/String.html#Substring(int,%20int) has a pretty good documentation and there is a lot of samples autour.
    This allows to mark your string in substrings as
    "08" (hours), '00' (minutes) and '00' (seconds).
    Integer.parseInt () allows to convert these values in integer values.

    The next class you use is calendar. Call instance() to get a Calendar object and http://www.blackberry.com/developers/docs/7.1.0api/java/util/Calendar.html#set(int,%20int) allows to set the appropriate fields.
    for example, with hourValue as type int with the value of the substring of the hour and myLittleCalendar as a calendar item:
    myLittleCalendar.set (Calendar.HOUR, hourValue);

    Note that a newly built calendar a date set to 0, then 01.01.1970, if you set only the component "hour", you will have the time this day.

  • Convert time UNIX DateTime in the creation of view script

    So, I'm trying to create a view that captures data in different tables 4 like this:

    create or replace view as

    Select distinct a.id, a.time, a.location, a.val

    a. a, B, b, C, c, D d

    where (a.id = b.id) and (b.id = c.id) and (c.id, d.id =)

    This is a c# code I have:

    public static DateTime DateTimeFromUnixTime (long timeT)

    {

    Return epochDate + new TimeSpan(timeT * TimeSpan.TicksPerSecond);

    }

    I guess that it is a function to convert I found: ('1970-01-01', "YYYY-MM-DD") + numtodsinterval(1244108886,'SECOND');

    I would like to format YYYY-MM-DD hh: mm:

    the a.time in time is unix, which is a decimal number for a long time. How I somehow convert it to Datetime format in the above sql Design view?

    that would require a subselect and join back based on id I guess.

    for example

    CREATE OR REPLACE VIEW display AS
    SELECT DISTINCT a.id,
                    to_char(to_date('1970-01-01',
                                    'YYYY-MM-DD') + numtodsinterval(a.time,
                                                                    'SECOND'),
                            'YYYY-MM-DD HH:MM:SS') AS time,
                    a.location,
                    a.val,
                    d.stacount
      FROM a a,
          b b,
          c c,
          d d,
          (SELECT ID, COUNT(DISTINCT(a.STA)) stacount FROM a GROUP BY ID) d
    WHERE (a.id = b.id)
      AND (b.id = c.id)
      AND (c.id = d.id)
      AND (a.id = b.id);
    
  • Convert time VBI

    Hi all

    Is it possible to convert the system clock for timing IST?

    so far,.

    nf = new Date();
    nfD = nf.getDate();    nfM = nf.getMonth();    nfY = nf.getFullYear();    nfH = nf.getHours();    nfMi = nf.getMinutes();    nfSec = nf.getSeconds();
    
    var currentTime = nfH+" : " + nfMi+" : " + nfSec;
    alert("currentTime: " + currentTime)
    

    Screenshot of output:

    Screen Shot 2015-10-19 at 06.33.14.png

    Thanks in advance

    Siraj

    Hi Siraj,

    Try this...

    //date system
    var sysDate = new Date();
    //UTC date
    var utcDate = new Date(sysDate.getTime() + sysDate.getTimezoneOffset() * 60000);
    //India Standard Time (IST) is 5:30 hours ahead of Coordinated Universal Time (UTC)
    var istDate = new Date(utcDate.getTime() + ((5.5*60)) * 60000);
    
    alert('\n System : ' + systemDate + '\n UTC : ' + utcDate + '\n IST : ' + istDate)
    

    Concerning

  • Convert time numbers words

    Hello

    Is there a built-in or freely available actionscript function that would convert numbers to words time. For example, '09:30 ' becomes '09:30? "

    Thank you!

    Oops, missed the requirement for numbers as words, added that in:
    "Edit: fixed ' 1 minutes" changed to "1 minute past"
    Edit2:clarity with number of type time

  • Convert time difference in seconds in hours, minutes, and seconds

    Hi all

    I used the following logic to calculate the time difference between 2 passes of time for all the individual lines.

    (floor ((TIME_ACTIONED-TIME_ALLOCATED) * 24) |) ':' || MOD (Floor ((TIME_ACTIONED-TIME_ALLOCATED) * 24 * 60), 60) |': ' | MOD (Floor ((TIME_ACTIONED-TIME_ALLOCATED) * 24 * 60 * 60), 60))

    The user asked a column that displays the SUM of all the differences in time between the report.

    Any help much appreciated!


    Thank you
    Sweta

    Simply the sum of time_actioned - time_allocated, then do the same calculation you make on this sum.

    John

  • Calculation of time

    Could use a little help. I work on the calculation of a starting time for a hike. I have the time I want to end up like 17:00, the next cell contains the number of miles. I want to take the time of the end, subtract the number of miles / 2 and ending up with a start time.

    Here is an example:

    Cell A1: 17:00

    Cell A2: 13

    Cells A3: some math to convert time functions (A1 - (A2 / 2)) = 10:30

    Make sense?

    You can subtract a duration of a period

    Enter the time in the cell B1

    Enter the distance you plane to travel to B2

    Enter the rate you plan to walk in cell B3

    calculate the length of walk in cell B4 by using the formula:

    = DURATION (0,0,B2÷B3)

    now calculate the start time in cell B5 by using the formula:

    B1−B4

  • How do I know the elapsed time


    Hello

    The difference between your option (a) and (b) is as below:

    (a) you get timestamp of the time before and after processes and subtract to find the elapsed time between the two... I will suggest you to convert time double data type before subtracting stamps...

    (b) you get "millisecond" of timer tick before and after the process count and subtract to find the elapsed time between the two... and last multiplication is 1000 to convert it to second...

    In my opinion, I'd rather (a)

    Thank you

    HS

  • How to get the time in UTC?

    Hi all

    8.6.1 LV + Windows XP SP2

    Over the last weekend, my code went to error because currently changed to summer time. This issue could be very easy, but I can't find a solution. How can I get the current time in UTC? For example, if the local time is 14:30 (+ 2: 00, winter time) my code display time 12:30 UTC. When I change the day after the last Sunday of may I get the same result. Because daylight saving time is the time of 14:30(+3h,_summer_time) should be 11:30. I also want to convert time to timestamp control...

    BR, Jim

    This link will help you:

    Get the Offset of UTC (Universal Time Coordinated) for a Timestamp in LabVIEW

  • time and Date/time in seconds

    Judging by some than others, it is a long-term problem.

    With the help of LV 8.6 incidentally.

    I'm trying to convert a date/time for LV timestamp format using the vi Date/time of seconds"." Recently converted time has been displayed as an hour before (I am in UK & DST is now in effect)-a problem I thought that I had healed.

    I wrote a simple test for the VI program (create a constant of the entry and use it to drive a bundle of cluster name to set s/hour/day/month/year etc.) With the function in a loop (0.5s) I have controls to change the month and isDST in the folder & isUTC in the function call - and displays the output in the form of stamp and as EXT. If the month is Pre-dst, everything is ok (for example, an hour of 10 stays at 10), if the month is 5 (DST) then the hour at 11 awards - unless isDST is set to 1 and isUTC set to false. but when this combination of controls is used with the months, a value of 2 - time becomes 9.

    As I say, I thought I had it healed and remember something on the Windows DST flag - and I had recently exchanged PCs - so I turned off the Windows DST (wDST) - no effect. This morning, I rebooted the PC to watch once again this program - to my astonishment, that the 'problem' had gone. I then checked the wDST it was always off. I stopped the criterion VI and closed and on wDST when you attempt to reload the VI of test I had a very weird error message telling me that my VI disk did not 'part of LV in memory' and inviting me to "come back". I stop LV completely rebooted and got the same effect. I restarted the PC and 'come back' was gone and the problem returns (wDST checked).

    So my initial dose had been disable wDST on my m/c origin.

    However, my query is what is the point of setting Date/time to seconds isUTC - it seems doing nothing like what he promises. What little LV blocks also on after I closed the program remember probably the DST Windows defining - maybe wrongly?


Maybe you are looking for