‎2006 Mar 21 5:28 AM
Hi,
Please help me as i require to display dates are per the country , for eg if it is US the date should be dd/mm/yyyy else for other countries like india it should be dd.mm.yyyy .
Regards
Abhishek
‎2006 Mar 21 6:02 AM
hai abishek,
try this one.
function group name--DATD
function group description--Date format
function module name---DATUMSAUFBEREITUNG
Country-specific date formatting for the current user.
Examples of output: MM/YY, MM/YYYY, DD.MM, M/D/YYYY, DD/MM/YYYY, WW/YY, WW/YYYY.
regards,
praba.
‎2006 Mar 21 5:34 AM
‎2006 Mar 21 5:39 AM
Hi Anjali,
Please read my query , i asked for country specific format dates.The FMs you have provided are for converting date formats.
Regards
Abhishek
‎2006 Mar 21 5:41 AM
Hi Abhishek
use this function "TZ_SYSTEM_TO_LOCAL"
Thanks
Tharani
‎2006 Mar 21 5:49 AM
‎2006 Mar 21 6:02 AM
hai abishek,
try this one.
function group name--DATD
function group description--Date format
function module name---DATUMSAUFBEREITUNG
Country-specific date formatting for the current user.
Examples of output: MM/YY, MM/YYYY, DD.MM, M/D/YYYY, DD/MM/YYYY, WW/YY, WW/YYYY.
regards,
praba.
‎2006 Mar 21 6:15 AM
‎2006 Mar 21 8:27 AM
‎2011 Nov 29 3:25 PM
I know this is an old thread, but thought I would add my on comments:
This code example shows how to create a country specific date format.
Also see table T005 and field DATFM / Domain DATFM
DATA: external_date LIKE rvdat-extdatum,
country LIKE t005-land1,
internal_date LIKE syst-datum,
internal_period LIKE tprg-prgrs .
internal_date = sy-datum.
internal_period = 1.
country = 'DO'. "Dominican Republic
CALL FUNCTION 'PERIOD_AND_DATE_CONVERT_OUTPUT'
EXPORTING
country = country " Enter Country Code Here
internal_date = internal_date
internal_period = internal_period " Default this value to one
LANGUAGE = SYST-LANGU
I_PERIV = I_PERIV
I_WERKS = I_WERKS
I_MRPPP = I_MRPPP
IMPORTING
external_date = external_date " The date formated for the country will be in this field
EXTERNAL_PERIOD = EXTERNAL_PERIOD
EXTERNAL_PRINTTEXT = EXTERNAL_PRINTTEXT
EXCEPTIONS
DATE_INVALID = 1
PERIODE_INVALID = 2
.
‎2022 Aug 23 10:35 AM
‎2006 Mar 21 6:11 AM
Hi Abhishek,
In your program, have a logic to get the User's country. You shd be able to get this from the user master Tx: SU01.
Then use the statement as below, where <country> is the user's country.
SET COUNTRY <COUNTRY>.
write lv_date to lv_date_usr_format.Now lv_date_usr_format will have the date in the country format set using the "SET CouNTRY" statement.
Pls reward points and close this thread, if this answers ur question.
Rgsd,
Prabhu.
‎2006 Mar 21 6:40 AM
Hi,
Create a FM with IMPORT parameter as I_DAT,I_LAND
EXPORT parameter as E_DAT.
and write following code
DATA : V_DATE LIKE SY-DATUM,
V_DATFM LIKE T005-DATFM,
V_DAY(2) TYPE C,
V_MONTH(2) TYPE C,
V_YEAR(4) TYPE C,
V_LEN TYPE C.
V_LEN = STRLEN( I_DAT ).
IF V_LEN = 8.
V_YEAR = I_DAT+0(4).
V_MONTH = I_DAT+4(2).
V_DAY = I_DAT+6(2).
SELECT SINGLE DATFM INTO V_DATFM
FROM T005
WHERE LAND1 = I_LAND.
CASE V_DATFM.
WHEN 1.
CONCATENATE V_DAY V_MONTH V_YEAR INTO E_DAT. SEPARATED BY '.'.
WHEN 2.
CONCATENATE V_DAY V_MONTH V_YEAR INTO E_DAT. SEPARATED BY '/'.
WHEN 3.
CONCATENATE V_DAY V_MONTH V_YEAR INTO E_DAT. SEPARATED BY '-'.
WHEN 4.
CONCATENATE V_DAY V_MONTH V_YEAR INTO E_DAT. SEPARATED BY '.'.
WHEN 5.
CONCATENATE V_DAY V_MONTH V_YEAR INTO E_DAT. SEPARATED BY '/'.
WHEN 6.
CONCATENATE V_DAY V_MONTH V_YEAR INTO E_DAT. SEPARATED BY '-'.
ENDCASE.
ENDIF.
Use this FM in your program wherever you required.
Thanks,
Pramod
‎2014 Aug 28 10:15 AM
I've found function module which can be used to convert date back to internal date.:
CALL FUNCTION 'PERIOD_AND_DATE_CONVERT_INPUT'
EXPORTING
DIALOG_DATE_IS_IN_THE_PAST = ''
EXTERNAL_DATE = external_date
IMPORTING
INTERNAL_DATE = internal_date
EXCEPTIONS
DATE_INVALID = 1
NO_DATA = 2
PERIOD_INVALID = 3
OTHERS = 4.