Answer:
SELECT
NOW() AS 'today_unformatted',
DATE_FORMAT(NOW(), '%d-%b-%Y') AS 'today_formatted';
Explanation:
%d represents date.
%b represents month.
%Y represents year.
Answer:
We use it everyday for all sorts of stuff
Explanation:
Answer:
Check the explanation
Explanation:
CREATE FUNCTION dbo.DateRange_sp4 ("at"StartDate DATE, "at"NumberofConsecutivedays INT) RETURNS "at"DateList TABLE ( DateID INT IDENTITY, DateValue DATE, Year SMALLINT, Quarter SMALLINT, Month SMALLINT, Week SMALLINT, DayOfWeek SMALLINT ) AS BEGIN DECLARE "at"Counter INT = 0; WHILE ("at"Counter < "at"NumberofConsecutivedays) BEGIN INSERT INTO "at"DateList VALUES ("at"Counter + 1, DATEADD(DAY, "at"Counter, "at"StartDate), DATEPART(YEAR, "at"StartDate), DATEPART(QUARTER, "at"StartDate), DATEPART(MONTH, "at"StartDate), DATEPART(WEEK, "at"StartDate), DatePart(WEEKDAY, "at"StartDate) ); SET "at"StartDate = DATEADD(day,"at"Counter + 1, "at"StartDate); SET "at"Counter += 1 END RETURN; END GO SELECT * FROM dbo.DateRange_sp4('2020-01-10', 20);
kindly check the screenshot below