... date format), arrange so it can be sorted alphabetically in reverse order
v_DatePart = v_SortingKey.getPrefix("T").toDate().toString("yyyy-MM-dd");
v_TimePart = v_SortingKey.getSuffix("T").getPrefix("+").subString(0,5);
v_SqlDateTime ...
... DATENAME(dd, getdate())
Weekday Number DAYOFWEEK(now()) DATEPART(dw, getdate())
Month Name MONTHNAME(now()) DATENAME(mm, getdate())
Month Number MONTH(now()) DATEPART(mm, getdate())
European Date ...
... -- SET YEAR RANGE (1912 - 1994: for Birthdate specifically: Older than 18 but younger than 100)
SET @MinYear = DATEPART(YEAR,GETDATE())-100; -- 100 years ...
... -- SET YEAR RANGE (1912 - 1994: for Birthdate specifically: Older than 18 but younger than 100)
SET @MinYear = DATEPART(YEAR,GETDATE())-100; -- 100 years ...
... ItemName,
DATEPART(dayofyear, ItemDate) as DayOfYear,
DATEPART(year, ItemYear) AS YearRun,
COUNT(ItemName) AS Counter
FROM
TableName
WHERE
ItemDate BETWEEN '01/01/2010' ...
... @StartDate DATETIME, @EndDate DATETIME
--First day of current month
SET @StartDate = DATEADD(s,0,DATEADD(mm, DATEDIFF(m,0,GETDATE()),0))
--First day to display on calendar
SET @StartDate = DATEADD(DAY,-DATEPART(WEEKDAY,@StartDate)+1,@StartDate)
--Last ...
... but I spent over an hour before I gave up trying to get SWITCH to work. Instead I cheated and got the ordinal in the Transact-SQL query:
CASE DATEPART(DAY, [MyDateValue])
WHEN 1 THEN 'st'
...
We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies. Read more about our Privacy Policy.