473,503 Members | 1,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date and time columns - days, hours mins between in SQL

2 New Member
I have a start and end date columns (date) and start and end time columns (varchar2).

I need to calculate the days, hours and minute between these 4 columns, I also have to exclude weekends and bank holidays (although I think i can do this bit)

I thought that concatenating the columns and converting might work but it doesnt seem to like it!

I would be very grateful for help.

Thanks,
Gem
May 21 '07 #1
3 3596
Saii
145 Recognized Expert New Member
Can you please post your query.

Thanks
May 21 '07 #2
cbsGEM
2 New Member
SELECT act34. mortgage,
act34.applseq,
(TO_DATE(TO_CHAR(PROGOPEN,'DD-MON-YYYY') || ' ' || PROGOTIME ,'DD-MON-YYYY HH24:MI:SS')) OPEN_DT,
decode(NULL,NULL,(TO_DATE(TO_CHAR(PROGCLOSE,'DD-MON-YYYY') || ' ' || PROGCTIME ,'DD-MON-YYYY HH24:MI:SS'))) CLOSE_DT
FROM act34


thats all I have so far
May 22 '07 #3
Saii
145 Recognized Expert New Member
SELECT act34. mortgage,
act34.applseq,
(TO_DATE(TO_CHAR(PROGOPEN,'DD-MON-YYYY') || ' ' || PROGOTIME ,'DD-MON-YYYY HH24:MI:SS')) OPEN_DT,
decode(NULL,NULL,(TO_DATE(TO_CHAR(PROGCLOSE,'DD-MON-YYYY') || ' ' || PROGCTIME ,'DD-MON-YYYY HH24:MI:SS'))) CLOSE_DT
FROM act34


thats all I have so far


select to_date(to_char(dt,'dd-mon-yyyy') ||' '|| to_char(to_date(var,'hh24:mi:ss'),'hh24:mi:ss'),'d d-mon-yyyy hh24:mi:ss') date1 from <table>

This gives the concatenated date from date and varchar fields. maybe u can create a function to wrap this code and pass individual date and varchar field to get date and then use that date values for further processing.

Note: You can do without converting dt to to_char, if needed

Hope that helps!!!
May 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2050
by: Drum2001 | last post by:
I have a table that contains the following fields: ItemName // Name of Assignment AvgTime //Estimated number of mins to complete I have a form that has a combo box listing all assignments...
3
2188
by: Paul Wagstaff | last post by:
Hi All I have an aggregate query that groups by each user, then calculates Sum(TimeInvested). I need to display the total time (per user) in hrs / mins e.g. 45:30 (= 45 hrs 30 mins). Can...
44
10128
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
1
1428
by: sesling | last post by:
I need some help with a date/time field. We run several processing jobs each day. The start and end times are stored in separate columns. The data is stored as date and time. I want to run a...
2
2695
cassbiz
by: cassbiz | last post by:
I am using strtotime and I have read up on some examples and am getting the wrong output, it jumps by several days instead of one day at a time. Ultimately what I am trying to accomplish is to set...
1
2194
by: ken | last post by:
Mostly so I can find this again when I need it: function formatTime(t) { var myTime = t.value; var badFormat = "Bad format"; // Ensure we have a value if (myTime == "") { return(true); }
0
1481
by: Gabriel Genellina | last post by:
En Fri, 02 May 2008 16:13:41 -0300, Simon Pickles <sipickles@googlemail.comescribió: Two options: a) You can construct a datetime object with that info, using...
10
2544
by: Scott | last post by:
I have an application that allows the user to pick a start date, then the enter in a number of hours to do a job, then a stop date fills out a textbox. Is there a way to find out the stop date? ...
0
16475
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.