The date functions allow the interaction and the calculation of date values.
|
Date functions
|
Syntax
|
NOW
|
The now-function returns the current date and the current time. The output depends on the language of the used operating system.
Example: =NOW() with the result: 2002-01-30 10:52:15 AM
|
NOW()
|
DATE
|
The date function returns the current date. The output depends on the language of the used operating system.
Example: =DATE() with the result: 2002-01-30
|
DATE()
|
YEAR
|
The year function returns the year of the date.
Example: =YEAR(#27.03.2006#) result: =2006
|
YEAR(date Datum)
Datum: The date from which the year should be returned.
|
MONTH
|
The month function returns the month of the year.
Example: =MONTH(#27.03.2006#) Result: =3
|
MONTH(date date)
Date: The date from which the month should be returned.
|
DAY
|
The day function returns the day of the month .
Example: =DAY(#2006-03-27#) Result: =27
|
DAY(date date)
Date: The date from which the day should be returned.
|
DATEADD
|
The date add function adds a specified value at a date.
Example: =DATEADD("m"; 9; #27.03.2006#) result: =27.12.2006
|
DATEADD(literal interval; number value; date date)
Interval: The part of the date, which should be changed.
parameters can be:
-
"yyyy" for year
-
"m" for month
-
"q" for quartal
-
"ww" for week of year
-
"w" for week day
-
"d" for day
-
"y" for day of year
-
"h" for hour
-
"n" for minute
-
"s" for second
"d", "w" are "y" are equal in this case
Value: The value, which should be added to the date.
Date: The date, which should be changed.
|
DATEDIFF
-
DATDIFF
|
The date difference function calculates the elapsed time between two dates.
Example: =DATEDIFF("yyyy"; #27.03.2006#; #27.03.2007#) Result: =1
|
DATEDIFF(literal interval; date date1; date date2;
[number first weekday] ;[number first yearweek])
Interval: The part of the date, from which the difference should be calculated.
Parameters can be:
-
"yyyy" for year
-
"m" for month
-
"q" for quarter
-
"ww" for week
-
"w" for full week
-
"d" for day
-
"y" for day of year
-
"h" for second
-
"n" for minute
-
"s" for second
"d" und "y" are equal in this case
"w" calculates the full weeks (that means in 7 day intervalls),
"ww" the amount of the weeks starting from the first day of the week
Date1: The starting date
Date2: The ending date
First week day: Defines, with which day the week shoul begin
The parameters can be:
- 1=Sunday
- 2=Monday
- 3=Tuesday
- 4=Wednesday
- 5=Thursday
- 6=Friday
- 7=Saturday
-
Default value is 2
First year week: Defines, which should be the first week of the year
Parameters can be:
-
1=the first week
is the week containing the 1.January
-
2=the first week
is the first week containing 4 days in the new year
-
3=the first week
is the first full week in the year Jahr (7 days)
-
Defaultwert ist 1
|
DATEPART
-
DATTEIL
|
The date part function returns a specified part of a date.
Example: =DATEPART("d"; #27.03.2006#) Result: =27
|
DATEPART(literal interval; date date;
[number first weekday] ;[number first yearweek])
Interval: The part of the date, which should be returned
Parameter can be:
-
"yyyy" for year
-
"m" for month
-
"q" for quarter
-
"ww" for week of year
-
"w" for weekday
-
"d" for day
-
"y" for day of year
-
"h" for hour
-
"n" for minute
-
"s" for second
-
"ww" returns the number of the week and is dependend from the defined first day of week
and from the first week of year
"w" is also dependend from the day of week, because this date the days are count
Date: The Date, from which a part should be returned
First weekday: Defines, with which day the week should begin
Parameters could be:
- 1=Sunday
- 2=Monday
- 3=Tuesday
- 4=Wednesday
- 5=Thursday
- 6=Friday
- 7=Saturday
-
Default value is 2
First year week: Defines, which should be the first week of the year
Parameters could be:
-
1=the first week
is the week containing the 1.January
-
2=the first week
is the first week 4 days in the new year
-
3=the first week
is the first full week in the new year (7 days)
-
Default value = 1
|
DATESERIAL
-
DATSERIELL
|
The date serial function returns a date with specified year-, month- and day values.
Example: =DATESERIAL(2006; 03; 27) Result: =27.03.2006
|
DATESERIAL(number year; number month; number day)
year: The year of the new date
month: The month of the new date
day: The day of the new date
|
WEEKDAY
|
The week day function returns the number of the transfered days in the week .
Example: =WEEKDAY(#27.03.2006#;1) Result: =2 Annotation: Because the one day is a Munday and
as week beginn Sunday is defined, the day is the 2. of the week.
|
WEEKDAY(date date ;[number first day of week])
Date: The date, where the day is contained.
First day of week: Defines, with which day the week should begin
The Parameters could be:
- 1=Sunday
- 2=Monday
- 3=Tuesday
- 4=Wednesday
- 5=Thursday
- 6=Friday
- 7=Saturday
-
Default value is 2
|
WEEKDAYNAME
|
The weekday name function returns the name of the transfered day.
The returned value is localised, that means if in the system control is set german,
it will be displayed for example "Sonntag", in englisch "Sunday" and so on
Example: =WEEKDAYNAME(3;true;6) Result: =Sun Annotation: Because friday is set as week begin
and the 3. day should be displayed, is the result sunday.
Because of the "true", which is transfered as parameter and as shortcut,
the returned value is only sun.
|
WEEKDAYNAME(number weekday ;[boolean shortcut] ;[number first day of week])
Week day: The number of the day, from which the name should be displayed.
Shortcut: Defines, if the day shoul be returned as shortcut .
Parameter: true for shortcut, false for the full name
Default value is false
First day of week: Defines, with which day the week should begin.
The parameters could be:
- 1=Sunday
- 2=Monday
- 3=Tuesday
- 4=Wednesday
- 5=Thursday
- 6=Friday
- 7=Saturday
-
Default value is 2
|
MONTHNAME
|
The month name function returns the name of the transfered month.
Der retruned value is localised, that means if in the system control german
is activated, it will be displayed for example "Januar", in englisch "January" and so om
Example: =MONTHNAME(3;false) Result: =März Annotation: The third month is marth
and because shortcut is "false" , is the returned value the full name of the month.
|
MONTHNAME(number month ;[boolean shortcut])
month: The number of the month, of which the name should be displayed.
Shortcut: Defines, if the day should be returned as shortcut.
Parameter: true for shortcut, false for full name
Default value is false
|
| CALENDARWEEK
|
Calculates the calendar week for the given date.
Example: =calendarWeek(#2008-1-4#)
result: 1
|
CALENDARWEEK(date Date; [number FirstDayOfWeek])
Date: The date for the calculation of the calendar week.
FirstDayOfWeek: Defines, with which day the week should begin.
The parameters could be:
- 1=Sunday
- 2=Monday
- 3=Tuesday
- 4=Wednesday
- 5=Thursday
- 6=Friday
- 7=Saturday
-
Default value is 2
|
| DAYOFCALENDARWEEK
|
Gets the date for a day in the specified calendar week.
Example: =dayOfCalendarWeek(1, 2, 2008, 1)
result: 31.12.07
Annotation: The example returns the date for the monday of the first calendar week in
the year 2008.
|
DAYOFCALENDARWEEK(number CalendarWeek; number Day; number Year; [number FirstDayOfWeek])
CalendarWeek: Specifies the clandear week where the day should be located.
Tag: Specifies the desired day of the week. (day number mapping see FirstDayOfWeek)
Year: The year of the desired calandar week.
FirstDayOfWeek: Defines, with which day the week should begin.
The parameters could be:
- 1=Sunday
- 2=Monday
- 3=Tuesday
- 4=Wednesday
- 5=Thursday
- 6=Friday
- 7=Saturday
-
Default value is 2
|
| DAYOFWEEK
|
Calculates the date for a desired day in a week given with the Date parameter.
Example: =dayofweek("2008-1-5", 2, 2)
result: 31.12.07
Annotation: The example returns the date for the monday of the week containing the 2008-1-5.
|
DAYOFWEEK(date Date; number Day; [number FirstDayOfWeek])
Date: The date which specifies the week range where the desired day should be located.
Day: The day of the week which was specified with the Date parameter. (day number mapping see FirstDayOfWeek)
FirstDayOfWeek: Defines, with which day the week should begin.
The parameters could be:
- 1=Sunday
- 2=Monday
- 3=Tuesday
- 4=Wednesday
- 5=Thursday
- 6=Friday
- 7=Saturday
-
Default value is 2
|