Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Базы";
Текущий архив: 2003.06.19;
Скачать: [xml.tar.bz2];

Вниз

Работа с датами. Операции.   Найти похожие ветки 

 
Disruptor   (2003-05-24 09:11) [0]

Как проверить, не прошло ли с такой-то даты до текущего момента
30, 40 или 50 лет. с использованием SQL - т.е. это будет располагаться внутри хранимой процедуры...
ПОдскажите...


 
Desdechado   (2003-05-24 12:41) [1]

по бытовому или точно (до секунд)?

погляди в сторону extract(...)


 
Alexandr   (2003-05-24 13:29) [2]

да...уж....
високосный год,переход на летнее и зимнее время...


 
Zacho   (2003-05-26 08:27) [3]

Посмотри http://www.ibase.ru/devinfo/DATETIME.TXT


 
Babay   (2003-05-28 09:44) [4]

SQL Books OnLine:

DATEDIFF
Returns the number of date and time boundaries crossed between two specified dates.

Syntax
DATEDIFF ( datepart , startdate , enddate )

Arguments
datepart

Is the parameter that specifies on which part of the date to calculate the difference. The table lists dateparts and abbreviations recognized by Microsoft® SQL Server™.

Datepart Abbreviations
Year yy, yyyy
quarter qq, q
Month mm, m
dayofyear dy, y
Day dd, d
Week wk, ww
Hour hh
minute mi, n
second ss, s
millisecond ms


startdate

Is the beginning date for the calculation. startdate is an expression that returns a datetime or smalldatetime value, or a character string in a date format.

Because smalldatetime is accurate only to the minute, when a smalldatetime value is used, seconds and milliseconds are always 0.

If you specify only the last two digits of the year, values less than or equal to the last two digits of the value of the two digit year cutoff configuration option are in the same century as the cutoff year. Values greater than the last two digits of the value of this option are in the century that precedes the cutoff year. For example, if the two digit year cutoff is 2049 (default), 49 is interpreted as 2049 and 2050 is interpreted as 1950. To avoid ambiguity, use four-digit years.

For more information about specifying time values, see Time Formats. For more information about specifying dates, see datetime and smalldatetime.

enddate

Is the ending date for the calculation. enddate is an expression that returns a datetime or smalldatetime value, or a character string in a date format.

Return Types
integer

Remarks
startdate is subtracted from enddate. If startdate is later than enddate, a negative value is returned.

DATEDIFF produces an error if the result is out of range for integer values. For milliseconds, the maximum number is 24 days, 20 hours, 31 minutes and 23.647 seconds. For seconds, the maximum number is 68 years.

The method of counting crossed boundaries such as minutes, seconds, and milliseconds makes the result given by DATEDIFF consistent across all data types. The result is a signed integer value equal to the number of datepart boundaries crossed between the first and second date. For example, the number of weeks between Sunday, January 4, and Sunday, January 11, is 1.

Examples
This example determines the difference in days between the current date and the publication date for titles in the pubs database.

USE pubs
GO
SELECT DATEDIFF(day, pubdate, getdate()) AS no_of_days
FROM titles
GO



 
Rel_   (2003-05-28 09:54) [5]

Удалено модератором
Примечание: Задай свой вопрос в отдельной ветке



Страницы: 1 вся ветка

Форум: "Базы";
Текущий архив: 2003.06.19;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.009 c
1-60123
dimonf
2003-06-06 12:52
2003.06.19
Как в дочернем объекте повеситься на обработчик родителя???


14-60375
Юрий Зотов
2003-06-02 15:51
2003.06.19
Купи - продам!


6-60305
Keksis
2003-04-18 15:49
2003.06.19
Протокол Udp


3-60041
Yan
2003-05-26 00:52
2003.06.19
TDataSetProvider


14-60416
AlexRush
2003-05-28 11:51
2003.06.19
Природа человеческого разума





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский