Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Date and Time Formatting

Former Member
0 Likes
565

Hi

I am having Date in a field type DATS,(YYYYMMDD)

and Time in anathor field type TIMS.(HHMMSS)

supoose date is: 20081204 and time : 185549

then I want to get in this format: 041220081855

Please suggest if there is any FM or how can i do this.

Amresh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
531

Hi First pass both the fields to character fields and then concatenate them.

Data:c_date(8),

c_time(6),

c_stamp.

c_date = Date.

C_time = Time.

concatenate c_date c_time into c_stamp.

Try this

good luck Neha.

4 REPLIES 4
Read only

Former Member
0 Likes
531

Try any of these:

DATE_GET_WEEK Returns week for a date

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_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:

Good luck from Neha

Read only

0 Likes
531

Neha, This will not solve I think .

Read only

Former Member
0 Likes
531

Hi

U need to elaborate the date in order to obtain your format:

DATA: MY_FORMAT(12) TYPE C.

MY_FORMAT(2) = SY-DATUM+6(2).

MY_FORMAT2(2) = SY-DATUM4(2).

MY_FORMAT+4(4) = SY-DATUM(4).

MY_FORMAT+8(4) = SY-UZEIT(4).

Max

Read only

Former Member
0 Likes
532

Hi First pass both the fields to character fields and then concatenate them.

Data:c_date(8),

c_time(6),

c_stamp.

c_date = Date.

C_time = Time.

concatenate c_date c_time into c_stamp.

Try this

good luck Neha.