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

formatting the time

Former Member
0 Likes
1,176

hi all..

we can get the date using the sy-datum which has a common format of dd-mm-yyyy..but i have a requirement to change the default format to some other format...can anyone please help me find out a method so that i can change the default format to some other format...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,066

hi,

take the date into variable lv_date of data type sy-datum

data: lv_dd(2) type c,

lv_mm(2) type c,

lv_yy(4) type c.

lv_date = sy-datum.

lv_dd = lv_date+6(2), here comes the date

lv_mm = lv_date+4(2), mnth

lv_yy = lv_date+0(4), year..

Npw you can use concatenate statement and make the date in your format..

EG: concatenate lv_dd lv_mm lv_yy into lv_newdate

seperated by '/'.

output: 14/05/2007..

Else if you need months in text you can use relevant Function modules ..

rewards if useful..

regards,

nazeer

hi all..

we can get the date using the sy-datum which has a common format of dd-mm-yyyy..but i have a requirement to change the default format to some other format...can anyone please help me find out a method so that i can change the default format to some other format...

7 REPLIES 7
Read only

Former Member
0 Likes
1,066

Hi,

check this link

rgds,

bharat.

Read only

Former Member
0 Likes
1,066

Hi,

In the Menu goto System --> User Profile --> Own data.

there in the default tab, u can set ur default formats.

Regards,

Himanshu

Read only

Former Member
0 Likes
1,066

Hi

Split the Day,month and year from the given date format and concatenate them as per your format.

Or use the edit mask command

or use the command WRITE date1 TO date2.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
1,066

hi

u can change the default settings either through system->user profile-->owndata

or

goto su01 transaction

give username and click change icon...and there ucan change the settings..

Read only

Former Member
0 Likes
1,067

hi,

take the date into variable lv_date of data type sy-datum

data: lv_dd(2) type c,

lv_mm(2) type c,

lv_yy(4) type c.

lv_date = sy-datum.

lv_dd = lv_date+6(2), here comes the date

lv_mm = lv_date+4(2), mnth

lv_yy = lv_date+0(4), year..

Npw you can use concatenate statement and make the date in your format..

EG: concatenate lv_dd lv_mm lv_yy into lv_newdate

seperated by '/'.

output: 14/05/2007..

Else if you need months in text you can use relevant Function modules ..

rewards if useful..

regards,

nazeer

Read only

Former Member
0 Likes
1,066

Date and Time Information

The following system fields are always set automatically. If necessary, the GET TIME statement synchronizes the application server time with that of the database server and writes it to the system field SY-UZEIT. SY-DATUM and the system fields for the local time zone, that is SY-TIMLO, SY-DATLO, and SY-ZONLO are also reset.

SY-DATLO

Local date of user, for example 19981129, 19990628.

SY-DATUM

Current (application server) date, for example 19981130, 19990627.

SY-DAYST

During daylight saving time X, otherwise empty.

SY-FDAYW

Factory calendar weekday, Sunday 0 … Saturday 6.

SY-TIMLO

Local time of user, for example 154353, 225312.

SY-TZONE

Time difference to Greenwich Mean Time (UTC) in seconds, for example 3600, 10800.

SY-UZEIT

Current (application server) time, for example 164353, 215312.

SY-ZONLO

Time zone of user, for example CET, UTC.

hope its useful for ur question,

reward points if its so,

thanks and regards

vijay

Read only

Former Member
0 Likes
1,066

Hi,

you can divide the date into day, month and year & can also concatenate the same as per your required format.

You can take the help from this code

data : d_date type sy-datum,

day(2),

month(2),

Year(4),

new_date(10).

d_date = sy-datum.

day = d_date+6(2).

month = d_date+4(2).

year = d_date+0(4).

concatenate day ':' month ':' year into new_date.

write : d_date.

write : new_date.

Regards,

Sandeep Kaushik