2010 Mar 30 4:12 AM
Hi Expert,
Do you know how to alter "Tue Mar 30 05:07:35 2010" to timestamp in ABAP, thanks.
Best Regards,
Andrew
Hi Expert,
Do you know how to alter "Tue Mar 30 05:07:35 2010" to timestamp in ABAP, thanks.
Best Regards,
Andrew
2010 Mar 30 4:44 AM
Hi
Use offset for the string, like
data: time(8),
str type string.
string = 'Tue Mar 30 05:07:35 2010'.
time = str+11(8). I hope it works, and alter it according to your system settings.
Thanks
Praveen
2010 Mar 30 5:08 AM
Hi,
First you will have to split the string into date and time and then use below function module.
CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'
EXPORTING
I_DATLO = lv_date
I_TIMLO = lv_time
IMPORTING
E_TIMESTAMP = lt_timestamp.This function module will give you timestamp.
Thanks,
Archana
2010 Mar 30 6:42 AM
Hi,
For example, "Tue Mar 30 05:07:35 2010"
It's still difficult to know the month.
Best Regards,
Andrew
2010 Mar 30 6:52 AM
2010 Mar 30 7:08 AM
HI
Split this Tue Mar 30 into three variable and collect the Month Name and pass this to T247 Table and get MNR value
Go to T247 table and pass this month and Language as EN you can get the Month Number
Your_Value Tue Mar 30 05:07:35 2010 pass this to a string
data : str type string.
str = your_value.
day = str+0(3). " Holds Day
mon = str+4(3) " Month
"select single mnr from t247 into Month_no where spras = 'EN' and ktx = mon.
date = str+8(2) " Date
time = str+11(8) " Time
year = str+20(4) " Year.
Concatenate year month_no date time into str. " This gives you Time Stamp.
Check the offsets once again to get the correct value and avoid Short Dumps saying " Invalid OffsetRegards
Ram
2010 Mar 30 7:17 AM
Hi Andrew,
If your string has fixed format like this then, you can split the string at space into different variables.
string "Tue Mar 30 05:07:35 2010" will be taken into different variables, v_dd, v_mm, v_date, v_time, v_year.
You will have to process variable v_mm, to convert from name to n umber. You can write case for this.
like Case v_mm,
if 'Jan'.
v_month = '1'.
The, concatenate v_dd, v_month, v_year into v_date.
And then call this FM.
Thanks,
Archana
2010 Mar 30 7:59 AM
data L_LASTCOLLWRT type string value 'Tue Mar 30 08:55:33 2010'.
data ls_mon type t247.
data l_mon type string.
data: time(8),
year(6),
mon(3),
week(3),
day(2).
split L_LASTCOLLWRT at space into week mon day time year.
year = year+0(4).
translate mon to upper case.
data l_input type string.
data l_output type string.
concatenate day mon year into l_input separated by space.
CALL FUNCTION 'CONVERSION_EXIT_IDATE_INPUT'
EXPORTING
INPUT = l_input
IMPORTING
OUTPUT = l_output.
*translate mon to upper case.
replace all occurrences of ':' in time with space.
*select single MNR into l_mon from t247 where SPRAS = sy-LANGU and KTX = mon.
data l_tmp type string.
concatenate l_output time into l_tmp.
*data l_date type DATS.
*data l_time type TimS.
*l_date = data.
*l_time = time.
*concatenate l_date l_time into l_tmp.
write: /, l_tmp.