cancel
Showing results for 
Search instead for 
Did you mean: 

How do I convert a string into a time stamp??

Former Member
0 Kudos

Hi,

Below is a representation of the Time Stamp of a JAVA default trace file:

#1.5

#00145E489D04016C0001031700130074000447C39A926E35#1204805344325#XIRUN.com.sap.aii.ibrun.server.valueMapping.ValueMappingService#sap.com/com.sap.xi.services#XIRUN.com.sap.aii.ibrun.server.valueMapping.ValueMappingService#J2EE_GUEST#0#SAP J2EE Engine JTA Transaction : []#XIP#PIAFUSER #47CF6344D7D702B6000000000AB6F547#output##0#0#Error#1#/Applications/ExchangeInfrastructure/IntegrationServer#Plain###Error During value mapping

........................

etc etc

I want to convert this string to a time stamp.

What is the process of doing this?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

the text below represents the date and time

#00145E489D04016C0001031700130074000447C39A926E35#1204805344325#

Does anyone have an Algorithm in java to convert it into a time stamp

Former Member
0 Kudos

In your case is the second token 1204805344325.

and you can get the date like that Calendar.getInstance().setTimeInMillis(1204805344325l).getDate().

But why u r not using the logviewer when you need to read the log files.

Florin

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

To convert these strings to timestamps, you can use logviewer lv.bat/lv.sh file. You can find this under :

j2ee\cluster\admin\logviewer-standalone folder.

e.g. you want to convert defaultrace file, following will be the command :

lv.bat defaultrace.trc -O newdefaultrace.txt

This will write all the output to newdefaultrace.txt with the strings converted to timestamp.

Hope this helps.

Regards,

Snehal

Edited by: Snehal Bhaidasna on Mar 17, 2008 12:04 PM

GabrielSagaya
Active Contributor
0 Kudos

You can convert By UDF

assume a="2004-07-24 09:45:52.189";

import java.util.;java.sql.;java.text.*;

function myudf(String a,Container container)

{

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");

java.util.Date date = sdf.parse(a);

java.sql.Timestamp timestamp = new java.sql.Timestamp(date.getTime());

return timestamp;

}