cancel
Showing results for 
Search instead for 
Did you mean: 

convert to julian date

Former Member
0 Kudos

Hi,

does anyone of you did some Message Mapping Java User Defined Function to convert an R/3 date format yyyy-mm-dd to julian date format? Or any idea how i could do it.

Any help would be appreciated.

Cheers,

Sven

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

See this posting (/message/2655755#2655755 [original link is broken]) for a possible solution.

Here's a quick adaptation from that posting using SAP date format (import java.util.* and java.text.*);

:

try

{

SimpleDateFormat datestamp = new SimpleDateFormat("yyyyMMdd");

Date baseDate = datestamp.parse("17000101");

Date sAPDate = datestamp.parse("20060324");

long dayDiff = (sAPDate.getTime() - baseDate.getTime()) / (1000 * 60 * 60 * 24);

System.out.println(dayDiff);

}

catch(Exception e)

{}

Tim

MichalKrawczyk
Active Contributor
0 Kudos

Hi Sven,

just search the google for any java class

that will do this conversion

import it as external archive and use it in the

message mapping

below you'll find an example but I don't know if this is what you're looking for

http://www.rgagnon.com/javadetails/java-0506.html

anyway the procedure is the same:

- get it from google

- import in XI as external archive

- use it in the message mapping

Regards,

michal

Shabarish_Nair
Active Contributor
0 Kudos

Can you specify the format you need the date to be converted to (YYYYMMDD or YYMMDD or others) so that we can help you out with?

Is it that you need the date from source to be put into the target or are you directly generating the date ?

Did you try the date functions (currentDate) in message mapping ?