From: Brian Candler Date: 2009-12-28T19:43:37+09:00 Subject: Re: unpack :( Alfonso Caponi wrote: > how can I use unpack a hex system date like this 2007-5-24,10:24:33.7 ? > > I'm trying with systemdate.unpack("H2H2-H2-H2,H2:H2:H2.H2") but it > doesn't works :( Please write your question more clearly, showing few lines of standalone ruby that demonstrate what you are trying to do. We don't have your "systemdate" method so we don't know what it returns. Are you saying that the source string looks like this? >> systemdate = "2007-5-24,10:24:33.7" If so, this is clearly not hex, this is a series of decimal values. So if that's not what you're trying to convert, please give an example of something that you are. Then, how do you want to "unpack" it? For example, do you want to split it into an array of numberics, e.g. [2007,5,24,10,24,33.7] - or something else? If I have guessed what you want, here is a starting point: >> systemdate.split(/[-,:]/) => ["2007", "5", "24", "10", "24", "33.7"] -- Posted via http://www.ruby-forum.com/.