To get today's date, you use the CURDATE() function as follows: mysql> SELECT CURDATE () today; + ------------+ | today | + ------------+ | 2017-07-08 | + ------------+ 1 row in set ( 0.00 sec Verwenden Sie AT TIME ZONE in Azure SQL-Datenbank oder Azure Synapse Analytics, wenn Sie Datums- und Uhrzeitinformationen in einer anderen Zeitzone als UTC interpretieren müssen. Eine Übersicht über alle Datums- und Uhrzeitdatentypen und zugehörige Funktionen für Transact-SQL finden Sie unter Date and Time Data Types and Functions (Transact-SQL). Use AT TIME ZONE in Azure SQL Database or Azure Synapse Analytics if you need to interpret date and time information in a non-UTC time zone. For an overview of all Transact-SQL date and time data types and functions, see Date and Time Data Types and Functions (Transact-SQL). Transact-SQL Syntax Conventions. Syntax GETDATE() Return Type. datetime. Remark The GETDATE() function returns the current database system date and time, in a 'YYYY-MM-DD hh:mm:ss.mmm' format. Tip: Also look at the CURRENT_TIMESTAMP function. Synta
how to write query to get today's date data in SQL server ? select * from tbl_name where date = <Todays_date> select * from tbl_name where date = <Todays_date> Stack Overflo SQL GETDATE function is a SQL Date and Time Function used to return the Current Date and Time. In this section, we use this Getdate function to find SQL Today's date with a practical example. The return value of this SQL GETDATE function derived from the OS (Operating System) of the computer on which the SQL Server instance is running How to Query Date and Time in SQL Server in SQL Server Get the date and time right now (where SQL Server is running): select current_timestamp ; -- date and time, standard ANSI SQL so compatible across DBs select getdate(); -- date and time, specific to SQL Server select getutcdate(); -- returns UTC timestamp select sysdatetime(); -- returns 7 digits of precisio --Today's data WHERE EmpInsertDate >=DATEADD(day, DATEDIFF(day,0,GETDATE()),0) AND EmpInsertDate < DATEADD(day, DATEDIFF(day,0,GETDATE())+1,0) Marked as answer by Anita A Monday, October 28, 2013 7:21 P
Beim Konvertieren in date- und time-Datentypen lehnt SQL Server alle Werte ab, die nicht als Datum oder Uhrzeit erkannt werden. Informationen zur Verwendung der CAST-Funktion und der CONVERT-Funktion mit Datums- und Uhrzeitdaten finden Sie unter CAST und CONVERT (Transact-SQL). Konvertieren von date-Werten in andere Datums- und Uhrzeittype you can get day, month and year separately by doing: select DAY (getdate ()) --1 select month (getdate ()) --5 select year (getdate ()) --2012. if you are on sql server 2008, there is the DATE date time which has only the date part, not the time: select cast (GETDATE () as DATE) --2012-05-01. Share How to return only the Date from a SQL Server DateTime datatype (44 answers) Closed 2 years ago. I'm looking for something similar to - DATEADD (day,-1,GETDATE ()) To use like this - and sale.OrderDateKey >= (current DATE (without time) - 1 day) e.g. and sale.OrderDateKey >= '2018-07-22'. sql sql-server date dateadd SQL GETDATE, SYSDATE, and TODAY Nearly every database engine will have a function that returns the current date. You will need to check the documentation with your engine, but it will typically be GETDATE, SYSDATE, or TODAY. These functions can be used as part of a separate function call DATETIME - format: YYYY-MM-DD HH:MI:SS. TIMESTAMP - format: YYYY-MM-DD HH:MI:SS. YEAR - format YYYY or YY. SQL Server comes with the following data types for storing a date or a date/time value in the database: DATE - format YYYY-MM-DD. DATETIME - format: YYYY-MM-DD HH:MI:SS. SMALLDATETIME - format: YYYY-MM-DD HH:MI:SS
SQL query for today's date minus year, month, day or minute. To add or subtract some date/time you can use MS SQL function: DATEADD (datepart, number, date) Let's say you need to add five months to current date, use this SQL Server 2019 (15.x) derives the date and time values through use of the GetSystemTimeAsFileTime() Windows API. The accuracy depends on the computer hardware and version of Windows on which the instance of SQL Server running. This API has a precision fixed at 100 nanoseconds. Use the GetSystemTimeAdjustment() Windows API to determine the accuracy mysql> SELECT DATE_SUB('1998-01-02', INTERVAL 31 DAY); +-----+ | DATE_SUB('1998-01-02', INTERVAL 31 DAY) | +-----+ | 1997-12-02 | +-----+ 1 row in set (0.00 sec) mysql> SELECT SUBDATE('1998-01-02', INTERVAL 31 DAY); +-----+ | SUBDATE('1998-01-02', INTERVAL 31 DAY) | +-----+ | 1997-12-02 | +-----+ 1 row in set (0.00 sec SQL Server DATEADD, EOMONTH, SWITCHOFFSET and TODATETIMEOFFSET Functions. DATEADD - returns datepart with added interval as a datetime. EOMONTH - returns last day of month of offset as type of start_date. SWITCHOFFSET - returns date and time offset and time zone offset SELECT CONVERT( date, GETDATE() ) auf einem SQL 2014 nicht funktioniert, kann ich mir nicht vorstellen. Ist der Zielserver auch ein SQL Server 2014? Oder zumindest einer mit mind. Version 2008? Falls ja, kann es sein, dass der Kompatibilitätsgrad der Datenbank auf 90 oder kleiner eingestellt ist? Falls es nicht läuft, welche Meldung erhältst Du? Gruß, Stefan Microsoft MVP - Visual.
SELECT DATEDIFF(day, '2007-05-07 09:53:01.0376635', '2007-05-08 09:53:01.0376635'); F. Angeben von numerischen Ausdrücken und skalaren Systemfunktionen für enddate. In diesem Beispiel werden ein numerischer Ausdruck, (GETDATE() + 1), und skalare Systemfunktionen, GETDATE und SYSDATETIME, als Argumente für enddate verwendet Intervals. In SQL, you can also use INTERVAL to add more time to any timestamp you have. For the examples below, you don't need to use the CAST() function, but I've chosen to do so only to have the date.. SELECT CAST(NOW() AS DATE) AS TODAY_DATE, CAST((INTERVAL '3 DAYS' + NOW()) AS DATE) AS three_days, CAST((INTERVAL '3 WEEKS' + NOW()) AS DATE) AS three_weeks, CAST((INTERVAL '3 MONTHS' + NOW. DAY (Transact-SQL) 07/30/2017; 2 Minuten Lesedauer; c; o; O; In diesem Artikel. Anwendungsbereich: SQL Server (alle unterstützten Versionen) Azure SQL-Datenbank Verwaltete Azure SQL-Instanz Azure Synapse Analytics Parallel Data Warehouse Diese Funktion gibt eine ganze Zahl zurück, die den Tag (Tag des Monats) des angegebenen Datums darstellt.. Unter Datums- und Uhrzeitdatentypen und. SQL Declare variable date Declare variable date. To declare a date variable, use the DECLARE keyword, then type the @variable_name and variable type: date, datetime, datetime2, time, smalldatetime, datetimeoffset. In the declarative part, you can set a default value for a variable. The most commonly used default value for a date variable is the function Getdate()
To get the current date, time, and timestamp using SQL, reference the appropriate DB2 registers: SELECT current date FROM sysibm.sysdummy1 SELECT current time FROM sysibm.sysdummy1 SELECT current timestamp FROM sysibm.sysdummy . It's one of the super useful functions like- LTRIM(), SUBSTRING_INDEX(), and similar that you can use in different scenarios.If you want to learn about SQL Functions, Joins, Trigger and all other concepts Step-by-Step, here's the SQL - Beginner to Expert course (having 320. Date Data Type. DATE is the oracle datatype that we are all familiar with when we think about representing date and time values. It has the ability to store the month, day, year, century, hours, minutes, and seconds. The problem with the DATE datatype is its' granularity when trying to determine a time interval between two events when the events happen within a second of each other
For this demonstration, we are going to write different SQL Date format Queries using CONVERT, and FORMAT function. The CONVERT function provides different formatting styles to format date and time. Without Century (yy) With Century (yyyy) Input/Output Standard - 0 to 100: mon dd yyyy hh:miAM (or PM) This is the Default for both datetime, and smalldatetime: 1: 101: 1 = mm/dd/yy 101 = mm/dd. SQL Server provides a number of options you can use for formatting a date/time string in SQL queries and stored procedures either from an input file (Excel, CSV, etc.) or a date column (datetime, datetime2, smalldatetime, etc.) from a table. One of the first considerations is the actual date/time value needed. The most common is the current date/time usin
Working with current dates and times in data science projects is quite common. In this episode of my SQL tutorial series I'll show you the best functions that return the actual time and date — or part of them. I won't just show you the SQL current date function, but many alternatives, so you can pick the one that fits your needs the best This Oracle tutorial explains how to use the Oracle / PLSQL CURRENT_DATE function with syntax and examples. The Oracle / PLSQL CURRENT_DATE function returns the current date in the time zone of the current SQL session as set by the ALTER SESSION command
SQL HOME SQL Intro SQL Syntax SQL Select SQL Select Distinct SQL Where SQL And, Or, Not SQL Order By SQL Insert Into SQL Null Values SQL Update SQL Delete SQL Select Top SQL Min and Max SQL Count, Avg, Sum SQL Like SQL Wildcards SQL In SQL Between SQL Aliases SQL Joins SQL Inner Join SQL Left Join SQL Right Join SQL Full Join SQL Self Join SQL Union SQL Group By SQL Having SQL Exists SQL Any. Other Date Functions. T-SQL also includes a bunch of other functions that help you to extract parts from dates. These include functions such as DAY(), MONTH(), YEAR(), DATEPART(), and DATENAME(). SQL, SQL Server date functions, dates, functions, how to, mssql, t-sql. Search. Tags . aggregate functions aggregation Azure Data Studio collation computed columns conversion functions convert create. SQL Code for todays date -90 days. kbaisch. 19 I have this code set up but I know the 3rd line is wrong. Could someone please help me on the code for pulling all entries for todays date -90 days? I would really appreciate it and thanks for helping. SELECT * from view1_4t where DOB_ = (getdate()-90) GO May 16 '07 #1. Follow Post Reply. 2 28014 . sandyboy. 16 I have this code set up but I know. . To declare a date variable, use the DECLARE keyword, then type the @variable_name and variable type: date, datetime, datetime2, time, smalldatetime, datetimeoffset. In the declarative part, you can set a default value for a variable. The most commonly used default value for a date variable is the function Getdate(). The function Getdate. Date functions in Standard SQL. BigQuery supports the following DATE functions. CURRENT_DATE CURRENT_DATE([time_zone]) Description . Returns the current date as of the specified or default timezone. Parentheses are optional when called with no arguments. This function supports an optional time_zone parameter. This parameter is a string representing the timezone to use. If no timezone is.
We have various in-built functions in SQL, which help us filter the useful data from a large set of data. One such part is the date and time functions of SQL. Using the date and time functions we can find the date today, we can check the date after some given time and so on For dates outside this range, SQLite attempts to map the year into an equivalent year within this range, do the calculation, then map the year back. These functions only work for dates between 0000-01-01 00:00:00 and 9999-12-31 23:59:59 (julian day numbers 1721059.5 through 5373484.5). For dates outside that range, the results of these functions are undefined. Non-Vista Windows platforms only. Presenting a technical session is a greatest experience one can have and I enjoy doing the same. While I write this blog post, I am presenting at Great Indian Developer Summit in India. The event is a grand success and I am having a great time at this event. One of the questions which I often receive is how do one can add the column to existing table which will be auto-populated with the.
How to get last 30 days data from today's date in SQL server. Please Sign up or sign in to vote. 0.00/5 (No votes) See more: SQL. server. i have to get record of all rows from last 30 to todays. i have tried this but isn't working What I have tried: select date_time from dsr_data where date_time >= CONVERT(Varchar(100), DATEADD(DAY,-30,GETDATE()),103) and date_time <= CONVERT(varchar(100. Spark SQL provides built-in standard Date and Timestamp (includes date and time) Functions defines in DataFrame API, these come in handy when we need to make operations on date and time. All these accept input as, Date type, Timestamp type or String. If a String, it should be in a format that can be cast to date, such a Datetime functions in Standard SQL. BigQuery supports the following DATETIME functions. All outputs are automatically formatted as per ISO 8601 , separating date and time with aT. CURRENT_DATETIME CURRENT_DATETIME([timezone]) Description. Returns the current time as a DATETIME object. Parentheses are optional when called with no arguments. This function supports an optional timezone parameter. hi, In my data table i have a Date Column with of type DateTime. In my sql select query, I want to return all records where the date is today. Thanks for any solution
Problem: You would like to display yesterday's date (without time) in an SQL Server database. Solution: SELECT DATEADD(day, -1, CAST(GETDATE() AS date)) AS YesterdayDate; Assuming today is 2020-09-24, the result is: yesterday_date 2020-09-23 Discussion: To get yesterday's date, you need to subtract one day from today's date Sorry if this isnt the best forum to ask this, but Im digging into a SQL data warehouse, which uses a date field. The data is populated from 2004 onwards, but I only want to pull the event data for date rows equal or later than TODAY, and less than or equal to 3 months from now. I can hard code the dates (showm below), but I want this to be automatic and ongoing
Summary: in this tutorial, we will introduce you to the MySQL DATE data type and show you some useful date functions to handle the date data effectively.. Introduction to MySQL DATE data type. MySQL DATE is one of the five temporal data types used for managing date values. MySQL uses yyyy-mm-dd format for storing a date value.This format is fixed and it is not possible to change it Wenn diese SQL Server BETWEEN CONVERT(date, GETDATE()) AND DATEADD(DD, -7, CONVERT(date, GETDATE())). Sie haben widersprüchliche tags. Ist dieser MySQL-oder Microsoft SQL Server? Der miteinander in Konflikt stehenden tags, das ist fast unmöglich zu beantworten. Die syntax unterscheidet sich erheblich zwischen mysql und sql server. Behoben. Mein schlechtes. Es ist SQL-Server. Alle technischen.
Re: sql WHERE filter on todays date I really don't want to confuse things, but it seems your original question was how to use date() (an xbasic function) in a sql query. I use the following code quite often, as it works as I expect it to work, and it gives me a lot of control SQL Server comes with the following data types for storing a date or a date/time value in the database: DATE - format YYYY-MM-DD; DATETIME - format: YYYY-MM-DD HH:MI:SS; SMALLDATETIME - format: YYYY-MM-DD HH:MI:SS; TIMESTAMP - format: a unique number; Note: The date types are chosen for a column when you create a new table in your database! For an overview of all data types available, go to. Transact-SQL includes a bunch of functions that help us work with dates and times. One of the more common tasks when working with dates is to extract the different parts of the date. For example, sometimes we only want the year, or the month. Other times we might want the day of the week. Either way, there are plenty of ways to do this in SQL.
Data_Type: We need to define data type along with length. In the date function, we use Varchar(length) data types Date: We need to specify the date that we want to convert ; DateFormatCode: We need to specify DateFormatCode to convert a date in an appropriate form. We will explore more on this in the upcoming section Let us explore various date formats using SQL convert date functions Code language: SQL (Structured Query Language) (sql) In this syntax: VARCHAR is the first argument that represents the string type.; datetime is an expression that evaluates to date or datetime value that you want to convert to a string; sytle specifies the format of the date. The value of style is a number predefined by SQL Server. The style parameter is optional Dealing with date and time data in SQL Server can be tricky. I see a handful of the same issues present themselves over and over again out in the forums, and also have many interesting conversations during my speaking engagements throughout the community. Some of the symptoms can just be confusion and ambiguity, but in other cases, you can end up with incorrect output, unexpected errors, or.
-- String to date conversion - sql date yyyy mm dd - sql date formatting -- SQL Server cast string to date - sql convert date to datetime. SELECT [Date] = CAST (@DateValue AS datetime)-- 2012-07-18 00:00:00.000 -- SQL convert string date to different style - sql date string formatting. SELECT CONVERT (varchar, CONVERT (datetime, '20140508'), 100 Returns a date part of a date as an integer number. GETDATE: Returns the current system date and time of the operating system on which the SQL Server is running. SYSDATETIME: Returns the current system date and time with more fractional seconds precision than the GETDATE() function. SYSUTCDATETIME: Returns the current system date and time in. . Published: 14 Sep 2016 Last Modified Date: 29 Nov 2019 Question How to dynamically filter the data on the last 24 months from today's date, when using a custom SQL table. Environment. Tableau Desktop; Custom SQL table; Answer Use the following WHERE clause:. In this example, we will get the years between two dates by using DATEDIFF SQL function. The start date is a constant value while the end date is again system's current time (assume this is 2018). See the query and result: The query with DATEDIFF: 1. 2. 3. SELECT DATEDIFF (year, '2010-03-13', GETDATE()) AS Years Difference; The result: Getting the number of months difference. Similarly. Code language: SQL (Structured Query Language) (sql) Notice that the DATEDIFF() function takes the leap year into account. As shown clearly in the result, because 2016 is the leap year, the difference in days between two dates is 2×365 + 366 = 1096
This article gives you all the information you need in order to begin working with dates in your PL/SQL programs. Dates, Time Stamps, and Intervals in PL/SQL. Most applications require the storage and manipulation of dates and times. Unlike strings and numbers, dates are quite complicated: not only are they highly formatted data, but there are also many rules for determining valid values and. How would I write a simple command to show the current date minus exactly one year? Any advice is appreciated. Thanks, Ryan Ryan Mcbee · Hi Ryan, GetDate() returns the current date, and DateAdd can be used for date math. You would do this: SELECT DateAdd(yy, -1, GetDate()) HTH! Aaron Alton | thehobt.blogspot.com · Hello, You can also use. echo Day , date ('w', strtotime ('2016-10-02 Monday next week')), of next week is , date ('d M Y', strtotime ('2016-10-02 Monday next week'));?> Prior to PHP 5.6.23, this results in: Today is Sun 2 Oct 2016, day 0 of this week. Day 1 of next week is 10 Oct 2016 Today is Sun 2 Oct 2016, day 7 of this week. Day 1 of next week is 10 Oct 201 SQL date format functions like the DateDiff SQL function and DateAdd SQL Function are oft used by DBAs but many of us never took the time to fully understand these extremely useful features. For professionals just getting started with SQL Server, these functions are some of the first to become familiar with. So hopefully this article will have a little something for everyone across the skill.
Today, We want to share with you how to insert date in sql.In this post we will show you create date column in sql, hear for how to insert date in sql in dd/mm/yyyy format we will give you demo and example for implement.In this post, we will learn about how to insert date in mysql using php? with an example . In this tutorial you will learn how to work with dates and times in SQL. Date and Time Manipulation. Along with strings and numbers, you often need to store date and/or time values in a database, such as an user's birth date, employee's hiring date, date of the future events, the date and time a particular row is created or modified in a table, and so on SQL date functions allow you to manipulate date and time data effectively. You can use the date functions for various operations such as adding days to a date, calculating the difference between two dates, or getting parts of a date
Use CusDB declare @ today datetime; set @ today = dateadd (day, 5, dateadd (day, datediff (day, 0, GETDATE ()), 0)); Select [Name],[Address],[MoveDate],[location] FROM [CusDB].[dbo] where MoveDate = @ today; You set the @today variable to midnight on your target date and just use that in your WHERE. The one caveat is your MoveDate column may also be storing date with non-midnight times in them. Is there a way to calculate today (and yesterday) of last month (and last year) in SQL? Assuming today is 26-May-2015 then how to find? Today of last year i.e. 26-May -2014? Today of last month i.e. 26-April-2015? Yesterday of last year i.e. 25-May-2014? Yesterday of last month i.e. 25-April-2015? sql-server sql-server-2008 datetime date. Share. Improve this question. Follow edited Dec 10 '15.
In SQL date format this would appear as something like 0000:01:14 10:03:00. Part 1 would see how many whole days have passed since the beginning of time, 0, and the 14 Jan in Year 0. This is 14 days. Part 2 would add these 14 days to the beginning of time - which would give the result 0000:01:14 00:00:00 - which is the date without the time. Remove the time from a SQL datetime using the. How to select data from today to last 5 days from the sql server 2005. example: tblPaymentDetail(Table Name) Fields Are: appPaymentDate appAmount In my table records are inserted like this: appPaymentDate appAmount 18-07-2012 100 16-07-2012 200 18-07-2012 300 15-07-2012 740 I want last 5 days record with sum of appAmount . Result: Assume todays date is 20-07-2012 I want 19-07-2012 0 18-07-2012.
A DATE data type contains both date and time elements. If you are not concerned about the time portion, then you could also use the ANSI Date literal which uses a fixed format 'YYYY-MM-DD' and is NLS independent. For example, SQL> INSERT INTO t(dob) VALUES(DATE '2015-12-17'); 1 row created All Time Today Last Week Last Month. Show. All Discussions only Photos only Videos only Links only Polls only Events only. Filtered by: Clear All. new posts. Previous template Next. buliwyf. Gesperrt. Join Date: 07.12.2007; Posts: 46; Share Tweet #1 Datensaetze mit aktuellem Datum abfragen? 25.11.2010, 11:46. Hallo Leute, wie kann ich als Bedingung einer Abfrage das aktuelle Datum abfragen. How do you perform a LIKE statement on a column of DateTime datatype in SQL Server? I had a SQL Query Like this: SQL. select CustomerID from Orders where OrderDate LIKE ' 1996-07- %' this returns me nothing! Posted 27-Jun-13 23:10pm. kesav prakash. Updated 5-May-21 6:26am _Amy. v2. Add a Solution. 4 solutions. Top Rated; Most Recent; Please Sign up or sign in to vote. Solution 1. Accept. Today, every SQL implementation has a DATE data type, but the functions available for them vary quite a bit. The most common ones are a constructor that builds a date from integers or strings; extractors to pull out the month, day, or year; and some display options to format output. Do not mimic 1970's COBOL and format data for display, using a proprietary vendor feature. In Standard SQL. The basic query that returns the date and time for SQL Server is . SELECT getdate(); This query will return the current date & time of your local machine. In my case, the result is: 13.04.2020 18:54:05 1.The simplest way to return Date Only . Just execute the next query: SELECT CONVERT(date, getdate()) In my case, the result is: 2020-04-13 2.The CONVERT method. This time, we are going to.
In SQL, datetime date data type is used for values that contain both date and time. Microsoft defines it as a date combined with a time of day with fractional seconds that is based on a 24-hour clock. SQL specifically, has many data types that combine both the date and time representations making things more complex. The most widely used one is the DATETIME as it has been present since the. today, I had always written statement such as this: How is this accomplished in sql? I am using a datetime data type, I hope that is correct . . . Thank you for your help. Ryan p.s. I tried getdate(), getdate, sysdate, and current_timestamp. All to no avail :(Jul 23 '05 #1. Follow Post Reply. 5 164480 . The Gekkster via SQLMonster.com . Hi Ryan, I'm new to SQL Server myself, but for your.
Getting only the date part of GetDate() is very simple. GetDate() returns the current SQL Servers timestamp in datetime format. In my earlier article, I have explained how to get date from datetime variable.You can use the same technique here There are many ways to format dates. For example, today is October 7, 2019. It is also 10-7-2019, 10-07-2019, 10/7/2019, 10/07/2019, 10/7/19, 2019-10-07, 07-10-2019 and Oct-7-2019. You get it. Tomato, to-mah-to. However, when writing queries in SQL, all dates are not created equal Spark SQL CLI: This Spark SQL Command Line interface is a lifesaver for writing and testing out SQL. However, the SQL is executed against Hive, so make sure test data exists in some capacity. For experimenting with the various Spark SQL Date Functions, using the Spark SQL CLI is definitely the recommended approach. The table below lists the 28. In this article i am going to explain how you can pass date range condition where clause in SQL server and also show you how you can filter record from particular table based on condition in where clause in SQL server as well as also explains how you can convert format of date in dd/MM/yyyy or yyyy-MM-dd in SQL server For this SQL Date Part example, We are going to use the below-shown data. How to Return Date Part Only from a SQL Server Datetime datatype Example 1. In this SQL Server example, first, we are going to declare a DateTime variable, and also use the GETDATE() function. Next, we are going to use the CONVERT, CAST, DATEADD, and DATEPART functions to.
How to get Today's Date in SQL/ Teradata / MySQL & Get Yesterday's Date Tags: MySQL, sql server. MORE NEWS . SQL Server data types. The data type is defined as the type of data that any column or variable can store in MS SQL Server. What is the data type? When you create any table or... SQL Server Management Studio. SQL Server Management Studio (SSMS) is an IDE that provides a graphical. Code language: SQL (Structured Query Language) (sql) The following shows the output: Even though CAST() is a standard-SQL function, not so many database systems support it.. Convert date to string using TO_CHAR() function. The DB2, Oracle, MySQL and PostgreSQL provide a function named TO_CHAR() that has a similar feature to the CAST function. You can use the TO_CHAR() function to format a date.