Solved

combining a date field with a time field 2 different formats - Oracle

Posted on 2013-11-20
2
1,110 Views
Last Modified: 2013-11-26
Good Afternoon Experts,
 I need some assistance on how to combine to fields together.

I have a field that is called surgery_start_date which a date field that shows as such:

8/25/2013 12:00:00 am

the other field called surgery_start_time is a vchar(5) fields with show the following
08:45

what I need is for to show up as

08/25/2013 08:45

how can this be achieved?  thanks in advance.
0
Comment
Question by:Butterfly2
2 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39664075
select to_char(surgery_start_date,'MM/DD/YYYY') || ' ' || surgery_start_time from table;
0
 
LVL 35

Accepted Solution

by:
johnsone earned 500 total points
ID: 39664096
That would work for display purposes.  If you wanted to do any kind of date math with it, you would need to turn the combined fields into a date like this:

to_date(to_char(surgery_start_date,'mmddyyyy')||surgery_start_time, 'mmddyyyyhh24:mi')
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle DB monitor SW 21 72
Not able to drop or recreate an Oracle stored procedure 1 48
Oracle encryption 12 59
oracle DR - data guard failover. 18 57
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question