From: Brian Candler Date: 2009-12-28T20:58:03+09:00 Subject: Re: unpack :( Alfonso Caponi wrote: > With systemDate = systemDate.unpack("H*") I've 07d90c1c0b2a28002b0100, > where 07d9 is 2009 in decimal, 0c is 12, 1c is 28 and so on.. :( It would still be easier if you showed the original string, but I'm guessing it's this: >> systemdate = ["07d90c1c0b2a28002b0100"].pack("H*") => "\a\331\f\034\v*(\000+\001\000" >> systemdate.bytes.to_a => [7, 217, 12, 28, 11, 42, 40, 0, 43, 1, 0] In that case: >> systemdate.unpack("nccccc") => [2009, 12, 28, 11, 42, 40] I'm not sure how you want the last 4 bytes interpreted, but a bit of googling for SNMP systemDate suggests the following: >> systemdate.unpack("nccccccAcc") => [2009, 12, 28, 11, 42, 40, 0, "+", 1, 0] i.e. 11:42:40.0 (tenths of a second) with a timezone of +01:00 -- Posted via http://www.ruby-forum.com/.