Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SNMP EventTime in Human Readable format in Java

Tags:

java

snmp

snmp4j

I have a stand alone java application that receives SNMP messages via an SNMP trap. I am using SNMP4J library in my application. In the SNMP message received, I need to convert the event time field, which is in hexadecimal format, into a human readable format. The event time field received normally looks as follows for example:

      eventTime*SNMPv2-SMI::enterprises.193.183.4.1.4.5.1.7.0 = Hex-STRING: 
07 DC 03 0C 12 15 2C 1F 2B 01 00 

Can anyone tell me how I can convert the text '07 DC 03 0C 12 15 2C 1F 2B 01 00' into a human readable datetime value with or without the help of SNMP4J library? Thanks.

like image 585
F. Aydemir Avatar asked Apr 14 '26 18:04

F. Aydemir


1 Answers

you can use Integer.parseInt("07dc", 16) and out 2012 pops, so this should give a hint of the year, the rest i'm sure you will figure out by yourself if this is indeed the year.

like image 164
Carl-Emil Kjellstrand Avatar answered Apr 16 '26 08:04

Carl-Emil Kjellstrand



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!