Add the hours and minutes so far
HelloI need to write a function that has two input parameters.
Parameter1 = > Date data type, the value is in GMT.
Parameter1 = > string value that indicates the time difference and it has the following format.
GMT (sign) HH24Mi
for the examples:
GMT + 400, GMT-1400
I need to add the offset (param2) to date (param1) and returned as output.
I wrote a simple code but cannot make it work. I would like to know if there is another way to do it.
create or replace
Function F_FUNCTION_NAME(dt date,timeZoneOffset in varchar2)
return date
As
offset varchar2(9);
Begin
Offset := (To_Char(Substr(Substr(Timezoneoffset,4),0,Length(Substr(Timezoneoffset,4))-2)||':'||Substr(Substr(Timezoneoffset,4),-2)));
return Dt + interval Offset hour to minute;
End;
Thank you.
Hello
Delete GMT and use the colon between the hours and minutes in this way:
ALTER SESSION SET nls_date_format='DD-MON-YYYY HH24:MI:SS';
SELECT SYSDATE
, CAST (CAST (SYSDATE AS TIMESTAMP WITH TIME ZONE) AT TIME ZONE '+4:00' AS DATE) offset_date
FROM DUAL;
SYSDATE OFFSET_DATE
---------------------- ----------------------
06-MAR-2013 12:08:01 06-MAR-2013 15:08:01
Kind regards.
Al
Tags: Database
Similar Questions
-
I want to add a long list of hours and minutes in numbers.
The list will come to 1000 + hours and I want that it displays the actual number of hours and minutes, not expressed in days.
Impossible to find a way to format the cells to allow me to th
Did you try & see if a few suggestions here may work?
• Create a custom cell format - Numbers Help for Mac:
http://help.Apple.com/numbers/Mac/3.2/#/tan090042718
The database can provide also other useful elements, if ticked off more.
Good luck & happy computing!
-
FIND THE HOURS AND MINUTES IN THE DATES
Hello
I REQUIRE THE OUTPUT IN HOURS, MINUTES FOR THE DIFFERENCE BETWEEN TWO DATE.
EX:
((1ER DÉCEMBRE 2009 13:01) - (2 DECEMBER 2009 13:01)))
RELEASED IN: 24.00 (24 HOURS: 00 MINUTES).
Kind regards
C V SHello
If DATEs are t1d and T2D, then:
TRUNC ( (dt2 - dt1) * 24 ) || TO_CHAR ( TRUNC (SYSDATE) + (dt2 - dt1) , ':MI' )
Returns a string like 24:00 ' or '1234:56' or ' 0:12 '
-
View the hours and minutes to obtain a difference in date
I can calculate a time difference by subtracting two date values. This translates into a numeric value. My question is how to return the calculated value in a date/time again?Hello
but does Oracle provide a built-in method of doing this?
Yes he did :)
A simpler than my last request version (well of course assuming you have the TIMESTAMP data type and no date datatype)
SELECT EXTRACT(DAY FROM &END_DATE - &START_DATE) * 24 + EXTRACT(HOUR FROM &END_DATE - &START_DATE) || ':' || EXTRACT(MINUTE FROM &END_DATE - &START_DATE) FROM DUAL
-
A1 = time predetermined 12:00
A2 = hour current NOW() example 09:30
A3 remaining duration = may, 02:30
A3 = # which States that negative values are too long to display.
All three cells are formatted with TIME hh: mm
Can anyone help me please with the cause of this error?
You asked your question in a forum for "other Windows applications"... so what program you want to use?
If Excel, ask here, using the drop-down 'version of Office' to select your version--> http://answers.microsoft.com/en-us/office/forum/excel
-
Less than 1 days according to the hours and minutes
Hi all:
I use Oracle Database 10 g Enterprise Edition Release 10.2.0.4.0
I have two values of date time
First: 16 January 2009 23:05 and second: 22 January 2009 00:015
I want to calculate the number of days between the two values.
Select to_date (January 16, 2009 23:05 ',' DD-MON-RRRR HH24 ') st.
TO_DATE (' January 22, 2009 00:15 ',' DD-MON-RRRR HH24 ") and,
round (to_date (January 22, 2009 00:15 ',' DD-MON-RRRR HH24 ')-)
TO_DATE (January 16, 2009 23:05 ',' DD-MON-RRRR HH24 ')) diff
Double;
TO_DATE ('16 - JAN - 200923:05 ',' DD TO_DATE ('22 - JAN - 200900:15 ',' DD DIFF))
------------------------------ ------------------------------ ----------
January 16 09 23:05 22 January 09 12:15:00 AM 5
Now, I want to change the diff as follows:
If the time is between 23:00 to 23:59 and then minus 1 of 5 (difference of means should be 4)
If the time is between 00:00 to: 00:59 and also less then 1 remained (difference of means should be 3)
Please note that these values are using as a parameter in a function
I want to check the values one by one.
Thank you
HassanYou should be able to use a CASE statement to produce values you want. It will be probably more difficult than nested functions you already use: (.) Something like (not tested)
select case when to_char(date,'hh24:mi') between '23:00' and '23:59' then whatever when to_char(date,'hh24:mi') between '00:00' and '00:59' then whatever else whatever...
-
How to get the date, the hour and minute of timestamp
Hello
I use Oracle 11.2.0.3.
I want to show a timestamp in this format:
dd/mm/yy HH24
I have treid this:
select TO_char('18-SEP-13 11.29.00.000000 AM','dd/mm/yy hh24:mi') from dual
But, I got:
ORA-01722: invalid number
Can you please help.
You convert a string not a timestamp. First convert the string to timestamp, then use TO_CHAR.
Select to_char
(
TO_TIMESTAMP (18-SEP-13: 11.29.00.000000 AM ',' DD-MON-RR hh.) AM FF ')
, ' dd/mm/yy HH24.
) val
of the double
-
DateTime picker - given to zero hours and minutes on the second click on the datepicker
Hello
(APEX 5.0.1 DB 11.2.0.3.0, operating system IBM AIX 7.1, time zone + 1 hour GMT Bratislava)
we have the date picker in the form region with the date format JJ. MM YYYY HH24
by clicking "Photo calendar" calendar appears with the date and the time displayed
This means that you can see in "hours selector" currently and in 'selector of minutes', you can see current minutes
You can change the date, the hour and minute you want
by clicking on the button "Close" you get the date and time in the date field picker
So far so good
However,.
If you click again on the calendar "Button photo calendar" appears and
If your current time (I mean normally on a day) is at 09:59
You will get Zero (0) hours in the hours, selector
After you present is from 10:00 correct, you will get 10, 11, 12, 13, etc.
It's for hours and minutes
If your current time is 10 minutes, for example 08: 07 , 11: 09 , 12: 03 , etc
On the second click, you'll get Zero (0) minutes
Similar problem is in the format JJ. MM YYYY HH: mi where you get the 01 in selector hours until 10:00
Will he please, focus on the fact that it is always on the second, third,... do not click on the first.
Any ideas please?
Kind regards.
Hello
It was recorded just as a default of 22376688.
Thank you.
-
show only the hours and the minutes of a timestamp
Hi, I have a timestamp column in OBIEE, but I just need to view the hours and the minutes and ignore everything else.
Is there a way to do this?
Thank you
use hh: mm
-
convert a number in days, hours and minutes
Hello
I have a table that store minutes unpaid.
I want to get the days, hours and minutes in separate columns
After working hours, a day is considered to be 8 hours
That is to say. 480 minutes is considered to be one day.
create the table unpaidmins as
(
Select 480 as unpaidmins of all the double union
Select 420 as unpaidmins of all the double union
Select 75 as unpaidmins of all the double union
Select 55 as double unpaidmins
)
Required result
--------------------------------------------------------------------
DAY HOURS MINUTES
---------------------------------------------------------------------
1 0 0
0 7 0
0 1 15
0 0 55
-------------------------------------------------------------------
I use oracle 10g
Help, please
Select
trunc(unpaidmins/60/8) as 'DAY '.
, trunc (mod (unpaidmins, 60 * 8) / 60) "the hours."
, mod (mod (unpaidmins, 60 * 8), 60) as "MINUTES".
of unpaidmins
DAY HOURS MINUTES
"1" "0" "0"
"0" "7" "0"
"0" "1" "15".
"0" "0" "55".
-
Problem converting from minutes to hours and minutes
Hello
I have a problem with this sql, the locations of this sql is to convert minutes to hours and minutes, for example, as you can see, I'm trying to convert 125 minutes in hours and minutes, so the result I get is 2.5 but it should be of 2.05
If you have an idea how I could get the result to the format: 2.05 which means two hours and 5 minutes?
It's my sql:
Thanks and greetingsSelect trunc(125/60) || '.' || (125 - TRUNC(125/60)*60) result FROM dual;
CarlosSelect trunc(125/60) || '.' || lpad(mod(125,60),2,'0') result FROM dual; RESU ---- 2.05 SQL>
SY.
-
conversion from minutes to hours and minutes
Hi all
I want to do two things
1. I want to convert minutes to hours and minutes which is
If there are 350 minutes it should be 5.50
2. I have two times column hrs and time allowed minutes now, I want to join this two in
in this way
for example the hrs is 5 and time allowed mins is 40 so I should be join under 5.40
Concerning
Aerts.Hello
The code is a little more readable now, but only a little.
For example, I can see now that you call most GRAND where the 1st argument is a string:
greatest(TO_CHAR ( FLOOR (((timeallowedhrs*60+timeallowedmins)-(timetakenhrs*60+timetakenmins)) / 60)) || ':'
This can cause the error, if the 2nd argument is a NUMBER, but how anyone can find what is the 2nd argument to the LARGEST?
Even though this may not cause the error ORA-01722, there is a good chance that it will give you wrong results. The string "2.00 ' is longer than the string"10 h 45', 2 'being greater than 1'. Perhaps you meant to do more BIG first, then TO_CHAR or maybe you menat another thing altogether.You can simplify the code you a lot if you did some calculations (such as (timeallowedhrs * 60) + timeallowedmin) only once, in a subquery.
For example:INSERT INTO prtempincent (...) WITH got_a_t AS ( SELECT DISTINCT (timeallowedhrs * 60) + timeallowedmin AS a , (timetakenhrs * 60) + timetakenmin AS t , jobcardno , shop ... ) SELECT jobcardno , '3' , ... FLOOR ( (a - t) / 60 ) || ':' || TO_CHAR ( MOD ( (a - t) , 60 ) , 'FM00' ) ...
I find
a - t
easier to read and understand (and debug), that
(timeallowedhrs*60+timeallowedmins)-(timetakenhrs*60+timetakenmins)
How about you?
-
Convert seconds to hours and minutes
Hello
I have a column that stores the elapsed time in seconds. I would like to convert to hours and minutes.
FOR EXAMPLE
126 seconds = 2:06. I can't find anything with a search.
Thanks in advance.Hello
Try this code.
Salim cordially.SELECT TO_CHAR (TRUNC (SYSDATE) + NUMTODSINTERVAL (126, 'second'), 'hh24:mi:ss' ) hr FROM DUAL; HR -------- 00:02:06 1 row selected.
-
Add the date and time to a photo
How to add the date and time to a photo or contact sheet in OS X El captain?
KADRI
Christiana
You want to write the date and time in the photo?
You need to do it in an external editor. Photos can't.
You can print the date and time and other legends on a Board-contact, however. When you select a photo and then use the model of the "Contact Sheet", you can click the 'Captions' button and select the metadata to use as the legend on the contact sheet.
To write directly to the photo, you can use the Preview.app.
Export the photo to go to Photos and then open it in preview or install the extension of"external editors" of the App Store. Then you can open preview directly from the Panel of editing in Photos. See this tip for user: external photo editors are here
-
Is it possible to add the location and the date on the pictures in a slide show?
Is it possible to add the place and the date on the pictures in a slide show?
Only if you manually add a title slide t photo and enter this information manually. There is no automatic way in Photos.
Click on the button "+" at the right end of the slide show to add a title slide.
Maybe you are looking for
-
Why stuff goes in the folder "Bulk Mail", its nothing that I put?
the choice of what goes on, as some of the same sources E-mail will appear in the "Inbox" folder and other times will be displayed in the "Bulk Mail" folder Your search for help on this topic creates a lot of gravity towards the inside, if you catch
-
Re: Satellite L300-1BV - create your recovery disc ISO images
I wondered about this.Could make my recovery disc ISO images, I know I could just make a few extra copies, but I am learning to create ISO images.But I was a little worried about what would happen when I put a disc in the drive...
-
Satellite Pro A200: RIS installation fails - BSOD
Hello Someone has already tried to use RIS for laptops Satellite Pro A200 ETA-1 image. I'm getting a BSOD which I think is due to a bad driver (downloaded from the Toshiba site). Also, can someone tell me where I can find a telephone number for techn
-
COMPAQ EVO D500: 1801 MICROCODE PATCH ERROR
When the PC boots it brings error 1801 could you help me slve this. or can I install a new OS
-
When I turn the windows firewall of it says that I have no firewall when avasts firewall is enabled
original title: firewall I activated the windows firewall and I have avast internet sercurity silent firewall but when I turn windows firewall it says I have no firewall when avasts firewall is enabled is it ok if I let both on