Question

How do I use to_date in Oracle to do this? I tried inputting the date and time but only the date shows up.How do I also...

How do I use to_date in Oracle to do this?

I tried inputting the date and time but only the date shows up.How do I also at 7 days to this date and change the time to 2 pm?

(SELECT TO_DATE('2019/05/19 04:00 PM', 'yyyy/mm/dd hh:mi AM') FROM dual),

GARAGE_CODE VUNIT_ID RESERVE_DA RENTER_NO
----------- ---------- ---------- ----------
12 451 19/05/2019 10

0 0
Add a comment Improve this question Transcribed image text
Answer #1

TO_DATE function convert string into date.

Your query is correct. It convert it into date and time as per your given format. But due to default format of date it only show you date. To see time you can use TO_CHAR method which return date and time as a string.

Use below sql:

SELECT TO_CHAR(TO_DATE('2019/05/19 04:00 PM', 'yyyy/mm/dd hh:mi AM'), 'yyyy/mm/dd hh:mi AM') FROM dual;

Syntax of TO_CHAR:

TO_CHAR(value [, format] [,language]

value: date or number which converted into string

format: Optional. format in which converted

language: Optional. language in which converted

To increase date simple + (add) number after TO_DATE.

To modify time use interval '2' hour [You can use minute at the place of hour for decrease minute] after TO_DATE.

Complete query is:

SELECT TO_CHAR(TO_DATE('2019/05/19 04:00 PM', 'yyyy/mm/dd hh:mi AM') + 7 - interval '2' hour, 'yyyy/mm/dd hh:mi AM') FROM dual;

Screenshot is given below:

Autocommit Display 10 SELECT TO_CHAR (TO_DATE (2019/05/19 04:00 PM, y/mm/ dd hh:mi AM)y/mm/dd hhimi AM) FROM dual: Resu

Autocommit Display 10 SELECT TO CHAR (TO DATE (2019/05/19 04:00 PM., .XXyX/mm/dd + 7 .XXyy/mm/dd hh:mi AM) - interval ·2 h

Add a comment
Know the answer?
Add Answer to:
How do I use to_date in Oracle to do this? I tried inputting the date and time but only the date shows up.How do I also...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I am using Oracle SQL and am new to it. I have seven tables, one of...

    I am using Oracle SQL and am new to it. I have seven tables, one of them is a subtable of two of the others. I need to do the following queries: 1. List all Patients and what Bed they are assigned to 2. List all patients who had Treatments and what Treatment they received 3. List all patients who had tests and what Test they had 4. List the employees (doctors, nurses, etc.) who assisted each patient. 5. List...

  • I am using oracle sql developer to create some queries to generated reports and it is...

    I am using oracle sql developer to create some queries to generated reports and it is not working. I am not sure how to use count, group by, and order by. Help me fix my query and explain to me how you did, so can do it next time. Also, I have to convert this query to a stored procedure, so can you help me do it too? Here is my query: SELECT COUNT(GUEST.FIRSTNAME), GUEST.FIRSTNAME, GUEST.LASTNAME, GUEST.GUESTTYPE, RESERVATION.RESERVATIONDATE, GUEST.EMAIL, FROM...

  • In this exam, you will design and implement a Python class called 'Date according to the...

    In this exam, you will design and implement a Python class called 'Date according to the following API specifications. • Do NOT use any existing classes in your answer such as datetime. . You will design your class so that it operates correctly on another planet, where the total days in a year, total days in a month, and months per year may be different. For our planet Earth, you will assume that a year has 360 days and all...

  • This is in Java The Problem: A common task in computing is to take data and...

    This is in Java The Problem: A common task in computing is to take data and apply changes (called transactions) to the data, then saving the updated data. This is the type of program you will write.             You will read a file of flight reservation data to be loaded into an array with a max size of 20. A second file will hold the transactions that will be applied to the data that has been stored in the array....

  • please help! please show work how do you find percentiles also I can't figure it out....

    please help! please show work how do you find percentiles also I can't figure it out. https://www.mathxl.com/student/Flayerromlewdrk Denise Herren & 6/30/19 7:02 PM MATH-1342-82011- Elementary Statistical Methods Homework: HW 5.3 Save HW Score: 40 % , 4 of 10 pts core: 0 of 1 pt 7 of 10 (5 complete) 5.3.33-T EQuestion Help The per capita energy consumption level (in kilowatt-hours) in a certain country for a recent year can be approximated by a normal distribution, as shown in the...

  • Given this IR Spectra of an unknown compound, how do I determine the structure of what I have? I think I have some sort of ketone? Possibly a methyl ketone. Attached is also the H-NMR. Please help de...

    Given this IR Spectra of an unknown compound, how do I determine the structure of what I have? I think I have some sort of ketone? Possibly a methyl ketone. Attached is also the H-NMR. Please help determine structure of unknown. the only other information i have is that it has a low molecular weight and is neutral 120-pennifers Gr own#1 110 100 80 70 60 50 40 30 20 4000 3500 3000 2500 2000 1500 1000 Wavenumbers (cm-1) ue...

  • Tasks A. (20 po ints) In Lab 6, you defined and implemented a class called Date....

    Tasks A. (20 po ints) In Lab 6, you defined and implemented a class called Date. You will make some modific ation to the Date class so that it mccts the folowing specific ations: The Date class consists of three private member variables: Member Variable year month day Description An int variable that hokls the value of a year. An int variable that hokds the value of a month An int variable that hokis the value of a day. The...

  • You are in charge of keeping track of Rutgers bus system. You operate a number of...

    You are in charge of keeping track of Rutgers bus system. You operate a number of different kind of bus, for example, “LX” or “REXL.” For each kind of bus, you want to keep track of the operating hours and days of operations (weekday or weekend). For example, “A” bus operates from 7:00 AM until 9:30 PM during the weekdays and “H” bus operates from 6:00 AM until 2:30 AM during the weekdays. For each bus, you want to store...

  • I need help in C++ . Project 3 – Parking Deck Ticketing System Objectives: Use if,...

    I need help in C++ . Project 3 – Parking Deck Ticketing System Objectives: Use if, switch, and loop statements to solve a problem. Use input and output statements to model a real world application Incorporate functions to divide the program into smaller segments Instructions: Your task is to write a program that simulates a parking meter within the parking deck. The program will start by reading in the time a car arrives in the parking deck. It will then...

  • * myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following...

    * myCompany.SQL Introduction to SQL Script file for ORACLE DBMS This script file creates the following tables: VENDOR, PRODUCT, CUSTOMER, INVOICE, LINE EMPLOYEE and loads the default data rows */ set echo on; set serveroutput on; select systimestamp from dual; show user; ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY'; DROP TABLE LINE CASCADE CONSTRAINTS; DROP TABLE INVOICE CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE VENDOR CASCADE CONSTRAINTS; DROP TABLE EMPLOYEE CASCADE CONSTRAINTS; CREATE TABLE...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT