05-17-2006 8:51 PM
Dear All,
Is there any function module to find the current date for a given time zone?
If anyone of you has written/worked on such function module it would be really helpful.
Thanks,
Amit
05-17-2006 8:55 PM
Check these FMs
TZON_CHECK_TIMEZONE
TZON_GET_TIMEZONE_TEXT
TZON_GET_USER_TIMEZONE
TZ_LOCATION_TIMEZONE
05-17-2006 8:58 PM
Amit,
Also check F1 help on the command CONVERT DATE.
CONVERT DATE dat [TIME tim [DAYLIGHT SAVING TIME dst]]
INTO TIME STAMP time_stamp TIME ZONE tz.
Addition:
... DAYLIGHT SAVING TIME dst
Effect
This statement adopts a date specified in dat, a time specified in tim, and a daylight saving time selection specified in dst as the local date and time specification for the time zone specified in tz, converts it to the UTC reference time, and assigns the result to the time_stamp variable as a time stamp.
05-17-2006 8:57 PM
Please see the <b>CONVERT TIME STAMP</b> statement.
<i><b>CONVERT for Timestamps</b>
Converts a timestamp into the correct date and time for the current time zone
Syntax
CONVERT TIME STAMP <tst> TIME ZONE <tz> INTO DATE <d> TIME <t>.
CONVERT DATE <d> TIME <t> INTO TIME STAMP <tst> TIME ZONE <tz>.
As long as <tst> has type P(8) or P(11) with 7 decimal placed, and <tz> has type C(6), the time stamp <tst> will be converted to the correct date <d> and time <t> for the time zone <tz>.</i>
Regards,
Rich Heilman
05-17-2006 9:01 PM
Rick, This works when we already have the date and time for the time zone. My req is to find this date and time for the user specified zone. If you have some examples.. Please let me know.
Thanks
Amit
05-17-2006 8:58 PM
hi amit,
try FMS
/SAPTRX/RANGE_CONVERT
CONVERT_TIME_TERMS
CIF_GEN3_CONVERT_DATETIME
CIF_GEN3_CONVERT_TIMESTAMP
CIF_GEN_CONVERT_DATETIME
CIF_GEN_CONVERT_TIMESTAMP
CIF_GEN4_CONVERT_DATETIME
CIF_GEN4_CONVERT_TIMESTAMP
CO_SF_CONVERT_TIMES_OPR
CXTP
DATE_TIME_CONVERT
POINT_IN_TIME_CONVERT
FITP_CONVERT_LOCAL_TIME_GMT
Tip : GO to -> SE37 and search key word TIME OR Convert
Regards,
Naveen
05-17-2006 9:02 PM
try
/SOMO/GET_TIMEZONE
GET_SYSTEM_TIMEZONE
<b>TIMEZONE
TIMEZONE2
TZON_GET_USER_TIMEZONE</b>
Hope thisll give you idea!!
<b>P.S award the points.</b>
Good luck
Thanks
Saquib Khan
"Some are wise and some are otherwise"
05-17-2006 9:19 PM
You will have to find out what the ajustment is for your time zone. Here is a sample program which uses the ajustments going backward and forward.
report zrich_0001.
data: tstamp type timestamp,
datum type datum,
uzeit type sy-uzeit,
new_date type sy-datum,
new_time type sy-uzeit,
stamp(14) type c,
time_zone_adjustment(6) type c,
index(2) type c.
set country 'US'.
datum = sy-datum.
uzeit = sy-uzeit.
* Go back
do 12 times.
index = sy-index.
concatenate 'UTC+' index into time_zone_adjustment.
condense time_zone_adjustment no-gaps.
convert date datum time uzeit into
time stamp tstamp time zone time_zone_adjustment.
clear stamp.
stamp = stamp + tstamp.
new_date = stamp+0(8).
new_time = stamp+8(6).
write:/ new_date, new_time.
enddo.
skip 1.
* Go forward
do 12 times.
index = sy-index.
concatenate 'UTC-' index into time_zone_adjustment.
condense time_zone_adjustment no-gaps.
convert date datum time uzeit into
time stamp tstamp time zone time_zone_adjustment.
clear stamp.
stamp = stamp + tstamp.
new_date = stamp+0(8).
new_time = stamp+8(6).
write:/ new_date, new_time.
enddo.
Regards,
Rich Heilman
05-18-2006 12:10 PM
Amit,
You can make use of the below system fields :
SY-DATLO -- Date and Time,Local date of user
SY-TIMLO -- Date and Time,Local time of user
SY-ZONLO -- Date and Time,Time zone of user
Please reward helpful answers
Cheers
Nishanth