05-23-2016 4:06 AM
sy-uzeit is the system time
sydatum is the system date
I know this, i don't want this i need the time in your laptop. The one on the most right bottom with the date and time.
Does anyone know this ?
05-23-2016 7:22 AM
Hi Mohamad ,
If the user is a windows user , in that case you can get the time zone of user's laptop.
You can code as below :
data: v_reg_value type string.
CALL METHOD cl_gui_frontend_services=>registry_get_value
EXPORTING
root = CL_GUI_FRONTEND_SERVICES=>HKEY_LOCAL_MACHINE
key = 'SYSTEM\CurrentControlSet\Control\TimeZoneInformation'
value = 'TimeZoneKeyName'
IMPORTING
reg_value = v_reg_value
EXCEPTIONS
get_regvalue_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5.
Regards
Yogendra Bhaskar
05-23-2016 5:26 AM
Check these fields:
SY-DATLO - Local Date for Current User
SY-TIMLO - Local Time of Current User
05-23-2016 5:37 AM
no this doesn't give me what i want. I want the laptop time of the user. Our application server is based in different location and this follows the server's OS date/time not the client date/time
05-23-2016 5:52 AM
Check below code:
DATA:L_TIME TYPE T,
L_DATE TYPE SY-DATUM,
L_TZONE TYPE TTZDATA-TZONE,
L_TSTMP TYPE TIMESTAMP.
CONVERT DATE SY-DATUM
TIME SY-UZEIT
INTO TIME STAMP L_TSTMP TIME ZONE SY-ZONLO.
CALL FUNCTION 'TZON_LOCATION_TIMEZONE' "Get current country's timezone
EXPORTING
IF_COUNTRY = 'IN' "----> Pass country key here
IMPORTING
EF_TIMEZONE = L_TZONE
EXCEPTIONS
NO_TIMEZONE_FOUND = 1
OTHERS = 2.
CONVERT TIME STAMP L_TSTMP TIME ZONE
L_TZONE
INTO DATE L_DATE
TIME L_TIME.
05-23-2016 6:14 AM
DATLO, TIMLO and ZONLO would give you the local values if the user has maintained a local timezone in their user profile (menu option System > User Profile > Own Data > Defaults).
05-23-2016 9:32 AM
SY-DATLO/SY-TIMLO provide the user's local time, based on his user profile time zone (transactions SU01/SU3). I know this can be sometimes a problem if the user travels, but it should be sufficient most of the time, and he can also adjust the timezone himself using SU3.
05-23-2016 7:22 AM
Hi Mohamad ,
If the user is a windows user , in that case you can get the time zone of user's laptop.
You can code as below :
data: v_reg_value type string.
CALL METHOD cl_gui_frontend_services=>registry_get_value
EXPORTING
root = CL_GUI_FRONTEND_SERVICES=>HKEY_LOCAL_MACHINE
key = 'SYSTEM\CurrentControlSet\Control\TimeZoneInformation'
value = 'TimeZoneKeyName'
IMPORTING
reg_value = v_reg_value
EXCEPTIONS
get_regvalue_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5.
Regards
Yogendra Bhaskar