‎2007 Oct 25 12:29 PM
Hi experts,
I would like to change the dates in my table so that they appear in the correct format. They appear in my database table as YY.YY.MMDD e.g. 20.07.10.25 for today's date. I would like to do a direct insertion into the table of the correct format i.e. 25.10.2007. I know how to select the incorrect dates. What's left is for me to change the dates and put them back into the db in the correct format, probably from an internal table.
Thanx in advance.
‎2007 Oct 25 12:30 PM
Hi,
Use FM 'CY_CONVERT_DATE'. It will convert the date into current user format.
Regards,
Prashant
‎2007 Oct 25 12:32 PM
Check the following Date Conversions
Option
... DD/MM/YY
Option
... MM/DD/YY
Effect
If f is a date field (type D ), the date is output with a 2-character year as specified in the user's master record. Both of these formatting options have the same value.
Option
... DD/MM/YYYY
Option
... MM/DD/YYYY
Effect
If f is a date field (type D ), the date is output with a 4-character year as specified in the user's master record. Both of these formatting options have the same value.
Option
... DDMMYY
Option
... MMDDYY
Effect
Date formatting like the additions ... DD/MM/YY and ... MM/DD/YY , but without separators.
Option
... YYMMDD
Effect
If f is a date field (type D ), the date is output in the format YYMMDD (YY = year, MM = month, DD = Day).
‎2007 Oct 25 12:36 PM
Hi
try like this. it will solve your problem
start-of-selection.
data: lv_date type sy-datum.
data: lv_formatdate(10) type c.
data: var1(4) type c,
var2(2) type c,
var3(2) type c.
lv_date = sy-datum.
var1 = lv_date+(4).
var2 = lv_date+4(2).
var3 = lv_date+6(2).
concatenate var3 var2 var1 into lv_formatdate separated by '.'. " By changing here Var position you can get your required output
Ex: var1 var2 var3
etc
Or try like this
Use this statement
date = 18012007
date1 like sy-datum.
write : date using edit mask '__.__.____'
to date1,
Output : 18.01.2007
CONVERSION_EXIT_IDATE_INPUT to convert date to Date format.
Regards
Pavan
‎2007 Oct 26 12:09 PM
Thanks all,
I have been able to do it using your method, Pavan. Now the thing is, I have to replace the incorrect dates to the converted dates into the DB table from an internal table using UPDATE but its saying work area not long enough. The table has too many fields, i cant put them ALL into the internal table. Do I need to? I just want to work with 2 fields in the DB table.
‎2009 Aug 04 12:15 PM
Hi,
Sorry for the late reply. After a long time i have again came to sdn forum. Does your issue solved??
Regards
Pavan
‎2007 Oct 25 12:35 PM
or u can use
CONCANICATE date9(2) '.' date6(2) '.' date(4) to date.
here date is the field in the internal table