You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done.
--http://msdn.microsoft.com/de-de/library/ms189794.aspx
SELECT DATEDIFF(second, '2005-12-31 23:59:59.9999999', '2006-01-01 00:00:00.0000000') AS Seconds
200
JavaScript
Datum, Zeit
Aktuelles Datum/Uhrzeit
date = new Date();
// Sat Jun 14 2014 13:15:27 GMT+0200 (CEST)
dateStringISO = date.toISOString();
// "2014-06-14T11:15:27.097Z" // Attention: Time is different because of the timezone
date.toISOString().substring(0,10);
//"2014-06-14"
dateStringISO.split("T")[1];
// 11:15:27.097Z
205
MySQL
Datum, Zeit
Tagesname
SELECT DAYNAME(NOW());
-- Monday
SELECT DAYNAME('2014-08-10');
-- Sunday
-- To get localized names switch the parameter, e.g. to German
SET lc_time_names = 'de_DE';
SELECT DAYNAME('2014-08-10');
-- Sonntag
209
SQLite
Datum, Zeit
Kalenderwoche eines Datums
-- Standard Weeknumber function from SQLite:
-- http://www.sqlite.org/lang_datefunc.html
SELECT strftime('%W', '2014-08-25')
-- The above calculation can lead to an wrong number if you expect an iso calendar week.
-- Therefore better:
-- http://stackoverflow.com/questions/15082584/sqlite-return-wrong-week-number-for-2013
SELECT
(strftime('%j', date('2014-08-25', '-3 days', 'weekday 4')) - 1) / 7 + 1 AS ISOCalendarWeekNumber;
210
T-SQL
Datum, Zeit
Kalenderwoche eines Datums
select DATEPART(ISO_WEEK,CAST('2014-08-25' AS DATE))
211
SQLite
Datum, Zeit
Jahr aus Datum extrahieren
SELECT strftime('%Y', '2014-08-25') AS Year;
212
SQLite
Datum, Zeit
Tagesname
-- There is no build in solution. Because of this you have to build a solution out of the weekday.
-- Be careful, the first weekday (0) is a sunday
SELECT
,CASE CAST(strftime('%w', myDateField) as integer)
WHEN 0 then 'Sonntag'
WHEN 1 then 'Montag'
WHEN 2 then 'Dienstag'
WHEN 3 then 'Mittwoch'
WHEN 4 then 'Donnerstag'
WHEN 5 then 'Freitag'
WHEN 6 then 'Samstag'
ELSE '????????????????????' END AS Tag_der_Woche_Deutsch
,CASE CAST(strftime('%w', myDateField) as integer)
WHEN 0 then 'Sunday'
WHEN 1 then 'Monday'
WHEN 2 then 'Tuesday'
WHEN 3 then 'Wednesday'
WHEN 4 then 'Thursday'
WHEN 5 then 'Friday'
WHEN 6 then 'Saturday'
ELSE '????????????????????' END AS Day_of_week_English
216
ORACLE PL/SQL
Datum, Zeit
Aktuelles Datum/Uhrzeit
-- if todays date is: 2014-02-02 then a static query would be
SELECT TO_DATE('02/02/2014','dd/mm/yyyy') FROM dual
-- system variable
SELECT SYSDATE AS TODAY FROM SYS."DUAL"
230
MySQL
Datum, Zeit
Jahr aus Datum extrahieren
SELECT extract(year from now()) AS Year;
SELECT extract(year from '2014-01-01') AS Year;
-- 2014
231
MySQL
Datum, Zeit
Monat aus Datum extrahieren
SELECT extract(month from now()) AS Month;
SELECT extract(month from '2014-07-01') AS Month;
-- 7