How do you obtain today’s date in Oracle, Access, and SQL Server?
Chapter8: Sql Functions And Procedures
Section: Chapter Questions
Problem 5RQ
Related questions
Question
How do you obtain today’s date in Oracle, Access, and SQL Server?
Expert Solution
Step 1
To obtain today’s date in Oracle:
- The Oracle CURRENT_DATE function returns the current date in the time zone of the session in the Gregorian datatype DATE calendar value.
- The format in which the date is displayed is dependent on the parameter NLS_DATE_FORMAT.
- The NLS_DATE FORMAT default setting is DD-MON-YY. This returns a 2-digit day, an abbreviation for a three-character month, and a 2-digit year.
Query to get current date:
CURRENT DATE DATE
SYSDATE
SELECT TO CHAR(CURRENT DATE,'DD-MON-YYYY HH:MI:SS') FROM Dual;
To obtain today’s date in Oracle:
The SYSDATETIME() function returns a DATETIME2 value that represents the current date and time of the system on the server running the SQL Server instance.
- The SYSDATETIME() function accepts no parameter:
Query:
SYSDATETIME()
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning