Function modules: Date and Time
2008-12-17 10:44
399 查看
if (window.name != "content")
document.write("
");
Date calculations
Hollidays
Checking dates
Converting dates
Formatting
Other
WEEK_GET_FIRST_DAY Returns first day for a week
RP_LAST_DAY_OF_MONTHS Returns last day of month
FIRST_DAY_IN_PERIOD_GET Get first day of a period
LAST_DAY_IN_PERIOD_GET Get last day of a period
RP_LAST_DAY_OF_MONTHS Determine last day of month
Date calculations
DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
DATE_IN_FUTURE Calculate a date N days in the future.
RP_CALC_DATE_IN_INTERVAL Add days/months to a date
RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from a date
SD_DATETIME_DIFFERENCE Give the difference in Days and Time for 2 dates
MONTH_PLUS_DETERMINE Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
DATE_CREATE Calculates a date from the input parameters:
Example: DATE_CREATE
Example: MONTH_PLUS_DETERMINE
data: new_date type d.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -5 " Negative to subtract from old date, positive to add
olddate = sy-datum
IMPORTING
NEWDATE = new_date.
write: / new_date.
Hollidays
HOLIDAY_GET Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.
HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the
date is a holiday by checking the parameter HOLIDAY_FOUND.
Example: HOLIDAY_CHECK_AND_GET_INFO
Checking dates
DATE_CHECK_PLAUSIBILITY Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
Converting dates
DATE_CONV_EXT_TO_INT Conversion of dates to SAP internal format e.g. '28.03.2000' -> 20000328 Can also be used to check if a date is valid ( sy-subrc <> 0 )
Function to return literal for month
he table you want to use is T247. You can also use the function MONTH_NAMES_GET. [ Monique Goodrich ,posted to SAP listserver]
You can also try table T015M. It has the month number in it's key.
[Walter Barr , posted to SAP listserver]
Formatting
DATUMSAUFBEREITUNG Format date as the user settings
Other
MONTH_NAMES_GET It returns all the month and names in repective language.
document.write("
Click here to show toolbars of the Web Online Help System: show toolbars |
Function modules: Date and Time
Get a dateDate calculations
Hollidays
Checking dates
Converting dates
Formatting
Other
Get a date
DATE_GET_WEEK Returns week for a dateWEEK_GET_FIRST_DAY Returns first day for a week
RP_LAST_DAY_OF_MONTHS Returns last day of month
FIRST_DAY_IN_PERIOD_GET Get first day of a period
LAST_DAY_IN_PERIOD_GET Get last day of a period
RP_LAST_DAY_OF_MONTHS Determine last day of month
Date calculations
DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.DATE_IN_FUTURE Calculate a date N days in the future.
RP_CALC_DATE_IN_INTERVAL Add days/months to a date
RP_CALC_DATE_IN_INTERVAL Add/subtract years/months/days from a date
SD_DATETIME_DIFFERENCE Give the difference in Days and Time for 2 dates
MONTH_PLUS_DETERMINE Add or subtract months from a date. To subtract a month, enter a negative value for the 'months' parameter.
DATE_CREATE Calculates a date from the input parameters:
Example: DATE_CREATE
CALL FUNCTION 'DATE_CREATE' EXPORTING anzahl_jahre = 1 anzahl_monate = 2 anzahl_tage = 3 datum_ein = '20010101' IMPORTING datum_aus = l_new_date.
Result: l_new_date = 20020304
Example: MONTH_PLUS_DETERMINE
data: new_date type d.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -5 " Negative to subtract from old date, positive to add
olddate = sy-datum
IMPORTING
NEWDATE = new_date.
write: / new_date.
Hollidays
HOLIDAY_GET Provides a table of all the holidays based upon a Factory Calendar &/ Holiday Calendar.HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the
date is a holiday by checking the parameter HOLIDAY_FOUND.
Example: HOLIDAY_CHECK_AND_GET_INFO
data: ld_date like scal-datum default sy-datum, lc_holiday_cal_id like scal-hcalid default 'CA', ltab_holiday_attributes like thol occurs 0 with header line, lc_holiday_found like scal-indicator. CALL FUNCTION 'HOLIDAY_CHECK_AND_GET_INFO' EXPORTING date = ld_date holiday_calendar_id = lc_holiday_cal_id WITH_HOLIDAY_ATTRIBUTES = 'X' IMPORTING HOLIDAY_FOUND = lc_holiday_found tables holiday_attributes = ltab_holiday_attributes EXCEPTIONS CALENDAR_BUFFER_NOT_LOADABLE = 1 DATE_AFTER_RANGE = 2 DATE_BEFORE_RANGE = 3 DATE_INVALID = 4 HOLIDAY_CALENDAR_ID_MISSING = 5 HOLIDAY_CALENDAR_NOT_FOUND = 6 OTHERS = 7. if sy-subrc = 0 and lc_holiday_found = 'X'. write: / ld_date, 'is a holiday'. else. write: / ld_date, 'is not a holiday, or there was an error calling the function'. endif.
Checking dates
DATE_CHECK_PLAUSIBILITY Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.Converting dates
DATE_CONV_EXT_TO_INT Conversion of dates to SAP internal format e.g. '28.03.2000' -> 20000328 Can also be used to check if a date is valid ( sy-subrc <> 0 )Function to return literal for month
he table you want to use is T247. You can also use the function MONTH_NAMES_GET. [ Monique Goodrich ,posted to SAP listserver]
You can also try table T015M. It has the month number in it's key.
[Walter Barr , posted to SAP listserver]
Formatting
DATUMSAUFBEREITUNG Format date as the user settingsOther
MONTH_NAMES_GET It returns all the month and names in repective language.
相关文章推荐
- Custom Date and Time Format Strings
- Formatting Time and Date: The Time and Date Format Suffixes
- Mysql:函数之三: date and time functions:重要的格式化函数
- DateAndTime 的命名空间Microsoft.VisualBasic(C#)
- 安卓时间拾取器(DatePicker And TimePicker)
- VBScript: Date and Time Constants
- [76] Changing appointments_What time and date did we finally meet?
- Date and Time
- Date and Time Format Patterns
- Custom Date and Time Format Strings
- Java Date, Calendar and Time API - Tutorial
- 使用ole中的Microsoft Date and time picker control来添加日期选择框
- java convert timestamp to date and time
- 安装Microsoft Date and Time Picker Control 6.0(SP4)控件
- Linux Set Date and Time From a Command Prompt
- Microsoft.VisualBasic.DateAndTime.Timer 与 DateTime.Now.TimeOfDay.TotalSeconds 相当
- Is not a valid date and time 不是有效的日期格式
- Documentation-Date and Time Programming Guide:About Dates and Times
- Java 8系列(一): 日期/时间- JSR310( Date and Time API)
- [原] XAF How to see and edit the time part in the DatePropertyEditor for the System.DateTime property