Application Development 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: 

DATE ( function module )

Former Member
0 Kudos

Hi ,

Suppose I have a DATE : 03.03.2007, is thr any function module to find out whether its a Sunday, Monday, Tuesday....Saturday of the week.

Regards

Avi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Use Function Module DAY_IN_WEEK... pass the date to this FM and it will return the day in number..

Then use FM DAY_NAMES_GET and pass the number to this FM to get the actual Day as u want...

reward points if helpful

10 REPLIES 10

Former Member
0 Kudos

Use Function Module DAY_IN_WEEK... pass the date to this FM and it will return the day in number..

Then use FM DAY_NAMES_GET and pass the number to this FM to get the actual Day as u want...

reward points if helpful

Simha_
Employee
Employee
0 Kudos

Hi,

You can use function module DATE_COMPUTE_DAY or DAY_IN_WEEK to get the numeric value of the day of the week. You can use function module WEEKDAY_GET to retrieve the language specific name of the week and an abbreviation of the name.

I hope this helps.

Sample code..

DATA : DATE like SCAL-DATE,

DAY LIKE SCAL-INDICATOR.

DATE = '20050728'.

CALL FUNCTION 'DATE_COMPUTE_DAY'

EXPORTING

DATE = DATE

IMPORTING

DAY = DAY.

CASE DAY.

WHEN 1.

WRITE 😕 'MONDAY'.

WHEN 2.

WRITE 😕 'TUESDAY'.

WHEN 3.

WRITE 😕 'WEDNESDAY'.

WHEN 4.

WRITE 😕 'THURSDAY'.

WHEN 5.

WRITE 😕 'FRIDAY'.

WHEN 6.

WRITE 😕 'SATURDAY'.

WHEN 7.

WRITE 😕 'SUNDAY'.

ENDCASE.

Cheers,

Simha.

Former Member
0 Kudos

hi,

chk this

DATE_TO_DAY

PARAMETERS date LIKE sy-datum DEFAULT sy-datum.

DATA day LIKE dtresr-weekday.

CALL FUNCTION 'DATE_TO_DAY'

EXPORTING

date = date

IMPORTING

weekday = day.

WRITE: / date , day.

1. Monday 2. Tuesday ...

Message was edited by:

Chandrasekhar Jagarlamudi

Former Member
0 Kudos

use fm DATE_TO_DAY

regards

shiba dutta

Former Member
0 Kudos

date_compute_day FM will give u the day of that date

regards,

bharat.

anversha_s
Active Contributor
0 Kudos

hi,

chk this.

DATA : day LIKE SCAL-INDICATOR.

CALL FUNCTION 'DATE_COMPUTE_DAY'
  EXPORTING
    date          = sy-datum
 IMPORTING
   DAY           = day
          .
WRITE : day.

Regards,

Anversha.S

Former Member
0 Kudos

Avi,

Use the FM "DATE_TO_DAY".

Pls. reward if useful

Former Member
0 Kudos

Hi,

Use the FM:

<b>RH_GET_DATE_DAYNAME</b> return the day based on the date provided

Hope this helps.

Reward if helpful.

Regards,

Sipra

Former Member
0 Kudos

Hi avi,

the fm not only gives the number of the day but also the name if u pass the

language parameter and date...

RH_GET_DATE_DAYNAME

hope this helps u a bit,

all the best,

regards,

sampath

  • mark helpful answers

Former Member
0 Kudos

Thx for the help.All Function modules are working for me