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: 

Sy-DATUM Format and display.

d4xtian
Participant
7,148

Hi

The format of Sy-datum is YYYYMMDD right...

1 - when you display sy-datum it print it the following format DD.MM.YYY

2 - when you assign sy-datum to a variable and you display it we get : DDMMYY

3 - If i want to extract only the MM, i need to use pos and number, knowing the format is YYYYMMDD

so

v_month = sy-datum+4(2)

date.png

capture-decran-2022-08-14-113623.png

my question is that's mean the sy-datum is automatically convert the format of the date when it is displaying ?

but there french and britain format that are same and us format, so i ll use the format of base where the server is ?

Thanks

1 ACCEPTED SOLUTION

ThorstenHoefer
Active Contributor
4,629

The country specified date is stored in Table T005X.

You can use for example the command

SET COUNTRY 'EN"

or use string templates like:

|{ sy-datlo COUNTRY = 'US ' }|

https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abendate_formats.htm


4 REPLIES 4

ThorstenHoefer
Active Contributor
4,630

The country specified date is stored in Table T005X.

You can use for example the command

SET COUNTRY 'EN"

or use string templates like:

|{ sy-datlo COUNTRY = 'US ' }|

https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-us/abendate_formats.htm


0 Kudos
4,629

Thanks, must use more ABAP Keyword Documentation before coming asking questioNs, thanks you....

0 Kudos
4,629

Or use

data(date_as_text) = |{ sy-datum date = user }|.

for the output in the users language.

Sandra_Rossi
Active Contributor
4,629

In ABAP, there are elementary types: C, D, N, etc.

Type D is for dates, which are 8 characters and internal format is YYYYMMDD (which itself is Gregorian calendar = today is year 2022, versus islamic calendar which could be year 1443 or 1444).

SY-DATUM is a variable of type D.

1 - depends on language environment

2 - depends on statement used and on language environment

3 - correct.

European format of dates is usually day followed by month, while US format is month followed by day.

For more information, see ABAP documentation: