date and time-functions

         

DATETIME FUNCTIONS

eom(date)

end of month

bom(date)

begin of month

eoy(date)

end of year

boy(date)

begin of year

month(date)

number of month

day(date)

number of day

dayofweek(date)

day of week (1=Monday)

relativedate(date,numberof days)

Date after/before adding/subtracting numberofdays

workday(date,numberofdays)

Date after adding numberofdays workdays

weekyear(date)

week in format yyyycc. Value is taken from factory calendar

weekstring(date)

formatet week in yyyy/cc

setvar=ls_week=%weekstring(<today,yyyy/mm/dd>)

messagebox=<ls_week>

return for date 2011/02/24:  "2011/01"

week(date)

week in format cc. This value is taken from the factory calendar, e.g. it is depending on the settings

CalendarWeek(date)

week in format cc. This value is calculated according to ISO 8601

CalendarYearWeek(date)

week in format yyyycc. This is the calculated value.

 

firstdayofweek(date)

return the first day of this week

lastdayofweek(date)

return the last day of this week

setvar=ls_week=%weekstring(<today,yyyy/mm/dd>)

messagebox=<ls_week>

return for date 2011/02/24:  "2011/02/27"

week2date(Jahrwoche yyyyww)

converts week to date

monthname(date)

name of month

dayname(date)

name of week-day

dbdatetime(date,time)

converts date, time to the database-format which can be specified in the WHERE-clause (depending on the Database-Server)

add_month(date,int month)

return date + count of month

setvar=ls_date=2016/05/01

setvar=ls_date=%add_month(<ls_date>,3)

result:

2016/08/01 (beas 9.1 PL: 08)





         

Examples:

 

message=%weekyear(2017/01/01) --> should be 201652, but is depending on database  

message=%calendarweek(2017/01/01) --> 52

message=%calendaryearweek(2017/01/01) --> 201652

 

message=%add_month(31.01.2017,3) --> 30.06.2017

message=%add_month(31.01.2017,1) --> 28.02.2017

message=%add_month(31.01.2017,37) --> 29.02.2017

message=%add_month(31.01.2017,-2) --> 30.11.2016