Day night time share

Day hours are from 06:00 to 22:00

Night hours are from 22:00 to 06:00


Need a function, pass in two dates: date and end_date beginning
Need to work the hours of the day and night hours.



start date: 13/01/2010 22:00 end_date: 14/01/2010-07:00


As in this example: starts at 22:00 oclock and put end to 07:00 in the morning, so there are 8 hours of night and day 1 hour.
Need to move to something like 'NIGHT' or 'DAY' to back hours day or night.


Any ideas...

Hello
The Site ate my <> where I wanted to compare not equal to,
now, I've changed to! =

with dat as (
select to_date('14/01/2010 13:00:00','DD/MM/YYYY HH24:MI:SS') start_date,
to_date('14/01/2010 17:00:00','DD/MM/YYYY HH24:MI:SS') end_date from dual)

select sum(day) day_hours,
sum(night) night_hours
from(
select
case when to_char(start_date,'DD') != to_char(start_date,'DD') then
case when (start_date+level/24) >= trunc(start_date)+22/24 and (start_date+level/24) <= trunc(start_date)+1.25 then
1
end 

else
case when (start_date+level/24) >= trunc(start_date)+22/24 then
1 end
end night
,
case when to_char(start_date,'DD') != to_char(start_date,'DD') then
case when (start_date+level/24) < trunc(start_date)+1+22/24 and (start_date+level/24) > trunc(start_date)+1.25 then
1
end 

else
case when (start_date+level/24) <= trunc(start_date)+22/24 then
1
end
end
day,
start_date+level/24

 from dat
connect by level <= (end_date-start_date)*24
)

Kind regards
Bobin

Tags: Database

Similar Questions

  • Disabling the automatic night time display mode

    night very my iphone goes into night time mode. How do I disable this so it is not automatic

    iPhone IOS 6 9.3.2

    Go to settings > display and brightness > night shift and turn off planned

  • iOS 9.3.1 Night Time Mode

    is not iOS 9.3.1 supposed to have a night time mode? I said by many people and showed by the Member of my family, that there is a night mode time turn off the blue light. I gave and updated my phone, which I don't usually do until Apple gets their stuff together and fix the bugs, but I've updated. When I upgraded to, absolutely nothing has changed. Why everyone has time mode at night but me? It's not as if I have an iphone 4. I have a 5 c. My brother has it: iPod Touch, both my parents have it on iPhone 5 s and I have a few friends with it on the iPhone 6. Is the simply excluded 5 c, considering this a happ before, or iOS for each different 9.3.1? (Want to ditching Apple, too many questions)

    Night mode requires five seconds or more.  The 5 c is essentially the equivalent of the iPhone 5. 5 and the 5 c do not contain the material needed to be implemented.

    < published by host >

  • Permit the supervisor change the day and time

    Hello

    What is the best way to allow the supervisor determine what time or what day the officers will be available to answer calls?

    The normal schedulle in my contact center is 08:00 to 17:00 in the week, but the supervisor want to change that in a few days or in a few weekends. Some options, I think I could solve this problem:

    (1) the script read an XML document, published by the contractor with the data and time

    (2) the contractor enters day and time settings in the Application Page of CRS

    (3) other?

    Thanks in advance

    André Lomonaco

    I did something similar for our contact centres who want to open the occasional weekend. Basically, I have a script that can close the contact (e.g. for emergencies) or open contact outside the "scheduled" time Center The script manipulates an XML file that contains a variable which is set to 'normal', 'open' or 'closed '.

    This can be an easier approach rather than trying to encode exceptions, for example, XML or DB file.

  • BlackBerry smartphones &lt; my blackberry lost day and time when connect you the bb to computer!

    Hi, my lost bb day and time when connect bb to the computer, the change time bb and another area, it is normal?

    My phone says dealer "it's normal in this smart phone" is really true?

  • What are the best days and times to send emails to customers?

    I heard and got great results with so many different days and times of the week to sending emails to prospects and customers.  What you find works best for you and what recommendations you have?

    Only way to find out what is the best time for * your * public. Test test test...

  • Like night and day, rendering time I just ridiculous unannounced.

    Hello.

    Last night I finished a 16 minute video (because of client tomorrow) of 5 d footage transcoded to Pro Res.  I returned using the HD Vimeo predefined in first and got the approval of the final draft, with the exception of a few downloaded changes on Vimeo.  This rendering took less than an hour.

    I make the changes requested (minimal things: shorten a scene here, lengthening it), save and try to return it in the same "Preset" Vimeo HD and now all of a sudden the first insists it takes five hours to make a pro-res of 16 minutes video which took less than an hour to do it last night.  Nothing has changed.  Several times the computer is restarted.  Trying to wire in different drives.  He is serious about the thing in five hours, too.  I left alone for a time thought that it is stunning, and it would end too fast last night.  Nope.  An hour into it still said four more.  In addition, the project has already made!  Green line throughout the entire timeline.  Unacceptable.

    Data sheet:

    Early 2008 Mac Pro (8-core 3.2 GHz)

    10.7.4 lion

    Premiere Pro CS5

    32GBs RAM

    Programs and project files on boot of 1 TB drive

    Sequences over 4 TB disk CalDigit eSata

    Trying to export to additional 4 TB disk CalDigit eSata

    Any help is greatly, strongly, greatly appreciated!

    Thank you!

    I've added effects is a work in Magic Bullet Looks for each clip

    Pfft!  Who's going to do.  Looks like is notoriously slow to make, more even at HD resolutions.  What you see, it's quite normal.  About the only things you can do to speed things up is to get a better GPU (looks is rendered with OpenGL), or remove the effects of looks.

  • BlackBerry 10 until 13 days standby time...

    The claim is that stadby. time is 13 days. If someone can specify this? My phone only holds power for about 2 days and a new presentation is necc.

    I have the model STL100-3. Must network be disabled while stadby. ?

    Standby time up to 13 days

    * Note: Battery life claims are for model STL100-3

    No, your device for voice, sms, data, e-mail, etc., you will not reach 13 days standby.

    If you have deleted all data applications, email, BBM, etc. of the device and used ONLY the voice you could very probably reach 13 days of battery life. Perhaps. Perhaps.

    But it would be the only way to get even closer to 13 days.

  • Day and time.

    Hello!

    I can't find how to put the date of the day on a page of Muse.

    It is possible or not?

    Select the Date and the day it takes to show the section and then copy the generated html code, insert in the page of Muse.

    http://time.is/widgets

    This will show live date and day for your site.

    Thank you

    Sanjit

  • APEX 4 Bug: time share at the date of display Gantt chart is a mess

    Hello

    A previous thread triggered bug 9861439 on dates in Gantt diagrams.
    It seems that everything has been corrected, but I think that something is wrong.

    When I on Date format dd-MMM-% YYYY % HH: mm %: %ss (current popup)
    Part 'date' is right but the time part is weird: hours always display 12 ', minutes display number of the month and seconds always show '00'.

    I tested twice in apex.oracle.com. You can test this?

    Oscar

    Hi Oscar,.

    Thank you for bringing this to my attention. I'll log a bug for this and should have a solution for it in our next release. Unfortunately, in implementing formatting dates in the component of the chart, the time slice is not properly treated. In the meantime, I suggest selecting a format where the component "hour" is not displayed. Sorry for the inconvenience that this may cause.

    Kind regards
    Hilary

  • Calendar.setTime defines the only year, month and day, no time

    Hello

    It is more a question of JAva instead of JDeveloper, but I still hope to get some answers here. I have problems, I have a Date (oracle.jbo.domain.Date) 2008-12-12 15:21:0. What I need is a string '121521' (day, hour, and minute - DDHHMM). This should be simple, but I'm strugling with this for a while now: $. I use class schedule so I can get the values using cal.get (Calendar.DAY_OF_MONTH), cal.get (Calendar.HOUR_OF_DAY) and cal.get (Calendar.MINUTE).

    Think I tried and none of them work:
          Calendar cal = Calendar.getInstance();
              Date ldETA = (Date)loETA; // this is the oracle.jbo.domain.Date 12/12/2008 15:21:0
    
              cal.clear();
              cal.setTime(ldETA.dateValue());
             // I try getting the values here
              try {
                cal.clear();
              cal.setTimeInMillis(ldETA.longValue());
             // I try getting the values here
              }
              catch (Exception e) {}
              
              java.util.Date loD = (java.util.Date)ldETA.dateValue();
              cal.clear();
              cal.setTime(loD);
             // I try getting the values here
    I always get only 12 for cal.get (Calendar.DAY_OF_MONTH) while cal.get (Calendar.MINUTE) and cal.get (Calendar.HOUR_OF_DAY) return 0.

    Help please: (.)

    Thank you
    BB

    BB,

    oracle.jbo.domain.Date is a subclass of oracle.sql.DATE, which has a method toText() - have you tried?

    John

  • time of day?

    I'm not sure if I have correctly implemented this code? (day and hour mode) sets, I want corresponding time stamp control with the mode appropriate to the day. For example:

    • 05:00 morning
    • 10:00 per day... and so on.

    My concern is with my implementation of the features compare to get any time before 05:00 as mode time 'night'... it works until 05:01 for the change of day. How can I get this code to change the mode of the day at 5:00? the other time of changes accordingly on their specific times (10:00, 17:00 and 21:00)...

    Put in a first element as 12:00 and do a night time mode.

  • Why is my desktop stop often randomly, at all hours of the day and night without prompting even when I use the computer. This is even though I changed the power option setting.

    Why is my desktop standby stop so often?

    It appeared sometimes several times per day or night. He stops consecutively, at random, at any time of day or night time. Even when I was with the computer, there is no incentive to me. The screen is blank. My computer nevers switch down. It's on 24/7-24 hours and 7 days, 365 days.

    It happened like this:

    1. you can hear the exhaust off the computer fan all of a sudden. There was no incentive. You can hear computer calmed down suddenly. The fan can be seen from the back of the grid of ventilation of the processor of the computer of the metal casing.

    2. the screen monitor suddenly stop. The screen is blank. The indicator light on the bottom of the screen of the monitor is always lit. He showed the monitor screen is on and running.

    3. When you look at the led on the computer, it is still lit. This shows that the computer has on photo and runnig. It is dormant, however.  He showed the computer CPU is entered in mode 'sleep'.

    4. whenever this judgment occurs, I would like to shut down the computer and restart the computer from scratch. I pressed the power button on the computer to stop it.

    5. I then press again the start/stop button to restart the computer, restart the computer, and then when she comes back to life, I clicked to restore sessions, and then I keep using the computer again.

    6. the process of restarting the computer was like that, as stops have been going like that for five months and is always like that, because I have been unable to solve. The point of contact in the power button is not more urgent are frequent.

    7. I changed the VGA cable as I said by a computer hardware that my problem could be due to the VGA cable is old, as in the VGA cable copper wire that feeds on the computer to the monitor screen can be broken or twisted, and so the video signals are not stable to feed the data to the screen of the monitor.

    8. Although I don't think that was the case, as my cable never touched the ground, or cluttered or kick or broken, I still went ahead to change the existing cable 15 pin VGA to 3 years with a new as it was only 3 males - the range of the cheapest I found in the shop costs...

    9. However, even if the VGA cable is changed, the stop is always the same, as before.

    10. on another month, I learned by my friend that I should change the setting in the computer mode 'sleep'.

    11. the new settings made in start/programs/system and Security / Option/power Power Plan/High Performance / 'Turn off display' to 'Never' and 'Put on the eve of the computer' to 'never '.

    12 even if I changed the setting of "Balanced (recommended) 'High Performance'" and two high-performance setting has been changed to "Never", the judgment fixed computer sleep mode, and as usual, no warning, the screen of the monitor erased.

    13. it seems the Option "power" and "Power Plan" and "Balanced" or "High Performance" in Windows 7 does not work. Window 7 does not in my computer.

    14. whenever I rebooted and restarted the computer, it is some normal time to see the operating system, repair files stop suddenly, before may be back from normal window of operation conditon.

    15. for more information,.

    My computer is not a brand. It was customized and installed. He bought two or three years ago. The use of the 350 GB hard drive is used by 50%. The computer in the past goes to sleep when there is no movement of the mosue for 15 minutes, or when not in use. He wakes up again when there mouse moves to restart the CPU and turn on the monitor screen.

    Now, he had problem with this kind of stop suddenly attack never wake up its "sleep" again during the month five, which I believe it was several viruses in the files of e-mail in the past months, and when it is very likely that I downloaded from CNET some cleaners or anti-spyware.  I don't know what problem is.

    I then withdrew them a month later of the program/Control Panel / uninstalled program. On the advice of my friend, I then changed version free download AVG.

    16. the information contained in the computer, start/program/computer/properties, gives the following information:

    It's Intel Core Due E7500 @ 2.93 Ghz, 4 GB of Ram, 32-bit operating system, windows 7 Home Premium, 2009.

    It is a Microsoft Firewall protection and is installed with fre download AVG anti-virus protection. He is shown to start/program/system and security / firewall /- and he said: 'Stat window firewall' is 'on '.

    17, finally, with the light of the foregoing, I would sincerely ask the Microsoft community to help solve this problem of closure. I would like to thank all the people in the community who can help me in advance here.

    18. I hope to hear your solutions with you. Thank you.

    Run "cleaners" or optimizers may have caused a number of problems.

    And since you have them installed some time ago a system restore won't help.

    Run the System File Checker

    http://www.SevenForums.com/tutorials/1538-SFC-SCANNOW-Command-System-File-Checker.html

    Run a scan for malware http://www.malwarebytes.org/products/malwarebytes_free/

    Maybe to repair your installation of win

    Ensure that the chipset drivers have been updated by the author of the motherboard

  • Display different text based on the time of day?

    Hello

    I want to have a msg text showing according to the time zone of the user of the native device. For example, when the user is during the day, it displays "Hello". And when the night time comes, it shows "good evening." Is there that an average muse can achieve this? If so, can you please tell me how? either use the widget or write javascript code by adding the html object? Thank you

    You can have fun with JavaScript date() functions. Search the Web. a lot of info on this around.

    Mylenium

  • Night games time MLB or NFL

    What kind of exposure values meet the photographers at the games of night time MLB or NFL?  Thank you.

    buffalobreath wrote:

    I'm not sports major league.  I shoot sports local high school, including football in a small, poorly lit rural Stadium.  My EV ratings are 6 to 7 in the center of the field.  The corners are about 4 to 5 EV...  I was just curious to know what the pros deal with.  Their photos appear blank.  I think that a lot of this has to do with the treatment.  I do my own RAW with Photoshop elements 14 files.

    My use a Canon EOS 1DX Mk 2 and a Canon 400 mm f4. DO IS 2.

    Thank you.

    I think that you should be able to get away underexpose by 1-2 EV, until the shutter speed with the gear.

    In addition, while this link may have said that night sports are about 9 EV, if the event is broadcast, are what most professional events like football, so the venue is on just a little more than 9 EV.

Maybe you are looking for