2006 May 29 1:38 PM
Hello everyone,
I need to convert "2.006123100000000E+07" to a date format.
How can I do it ?
Thanks in advance.
2006 May 29 1:47 PM
Hello David,
You could it like this:
DATA:
zlv_float TYPE f VALUE '2.006123100000000E+07',
zlv_integer TYPE i,
zlv_date TYPE d.
zlv_integer = zlv_float.
write zlv_integer to zlv_date.
Regards,
John.
2006 May 29 1:42 PM
JUST EDITED THIS ONE, NOW U GET THE VALUE INTO THE STRING>>>
REPORT GEN.
DATA : float TYPE f.
DATA : string(15) TYPE c.
float = '21.12345'.
CALL FUNCTION 'FLTP_CHAR_CONVERSION'
EXPORTING
DECIM = 0
* EXPON = 0
input = float
* IVALU = ' '
* MASKN = ' '
IMPORTING
flstr = string
.
WRITE 😕 float.
WRITE 😕 string.
2006 May 29 1:48 PM
Hi Rahul,
If I put the following float "2.006123100000000E+07" instead "41.356661234", it gives me a dump.
Thanks.
2006 May 29 1:47 PM
Hello David,
You could it like this:
DATA:
zlv_float TYPE f VALUE '2.006123100000000E+07',
zlv_integer TYPE i,
zlv_date TYPE d.
zlv_integer = zlv_float.
write zlv_integer to zlv_date.
Regards,
John.
2006 May 29 1:51 PM
2006 May 29 2:48 PM
Hi John,
Looks good logic but when i give the f value '2.006123200000000E+07' it is printing the date as
32122006. This date is not valid
Hope we need to validate the date while conversion.
DATA:
zlv_float TYPE f VALUE '2.006123200000000E+07',
zlv_integer TYPE i,
zlv_date TYPE d.
zlv_integer = zlv_float.
write zlv_integer to zlv_date.
write zlv_date.
2006 May 29 2:50 PM
HI PLEASE TRY OUT WITH THE CODE I HAVE GIVEN, IT WORKS PERFECTLY ACCORDING TO THE REQUIREMENT
BY THE WAY THIS IS JUST THE WAY TO GET FLOAT INTO ANOTHER VARIABLE... IF U WANT THAT TO BE VERIFIED THEN U NEED TO DO THAT MANUALLY USING SOME CODE
2006 May 29 3:29 PM
Hi Aluru,
Just add 'DD/MM/YYYY' and you will get a perfect date:
write zlv_date dd/mm/yyyy.
John.
2006 May 29 3:40 PM
REPORT ychatest .
DATA : p_float TYPE f,
p_date LIKE cawn-atwrt,
p_flt LIKE cawn-atflv,
p_dt LIKE sy-datum.
.
p_float = '2.006123100000000E+07'.
p_flt = p_float.
CALL FUNCTION 'CTCV_CONVERT_FLOAT_TO_DATE'
EXPORTING
float = p_flt
IMPORTING
date = p_date.
WRITE : p_date TO p_dt DD/MM/YYYY.
WRITE : p_dt.
2006 May 29 1:48 PM
hi ,
use convert key word.
that is
syntax
CONVERT TIME STAMP tst TIME ZONE tz INTO DATE d TIME t.
Example
CONVERT TIME STAMP lv_timestamp TIME ZONE SY-ZONLO INTO DATE d TIME t.
lv_timestamp type should be TIMESTAMP or TIMESTAMPL,
Mark Helpfull answers
Reagrds
Mark Helfull answers.
2006 May 29 1:49 PM
Hi david,
try CTCV_CONVERT_FLOAT_TO_DATE.
regards,
Suresh Datti
2023 Nov 16 11:01 AM