%D-Day of month with English suffix (0th, 1st, 2nd, 3rd).DATE_FORMAT(): Displays date/time data in different formats.Syntax: DATE_FORMAT(date,format) ĭate is a valid date and format specifies the output format for the date/time.DATEDIFF(): Returns the number of days between two dates.Syntax: DATEDIFF(date1, date2) Įxample: SELECT DATEDIFF('','') AS DateDiff.Syntax for DATE_SUB is same as DATE_ADD just the difference is that DATE_SUB is used to subtract a given interval of date. DATE_SUB(): Subtracts a specified time interval from a date.Output: Name BirthSecond Pratik 20:44:15.581 SELECT Name, DATE_ADD(BirthTime, INTERVAL 4 HOUR) AS BirthHourModified FROM Test.Output: Name BirthDayModified Pratik 16:44:15.581 SELECT Name, DATE_ADD(BirthTime, INTERVAL 30 DAY) AS BirthDayModified FROM Test.Output: Name BirthTimeModified Pratik 16:44:15.581 SELECT Name, DATE_ADD(BirthTime, INTERVAL 1 YEAR) AS BirthTimeModified FROM Test.MICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR, etc.įor the below table named ‘Test’ Id Name BirthTime 4120 Pratik 16:44:15.581 Where, date – valid date expression and expr is the number of interval we want to add. Syntax: DATE_ADD(date, INTERVAL expr type) DATE_ADD() : Adds a specified time interval to a date.ISRO CS Syllabus for Scientist/Engineer Exam.ISRO CS Original Papers and Official Keys.
GATE CS Original Papers and Official Keys.