From: SpringFlowers AutumnMoon Date: 2007-09-23T17:20:49+09:00 Subject: Re: Questions about Date.strptime Allen Young wrote: > strptime is the right place to go. For some formats of string it's [...] > > '20070912': there is no '.', '-' or '/' as the seperator and '%Y%m%d' > doesn't work, it will throw an exception saying that: "ArgumentError: 3 > elements of civil date are necessary". looks like it would be handy if there is something like Date.strptime("010207", "%2m%2d%2y").to_s but right now that won't run. maybe it tries to avoid ambiguity. you can at least use one of these: a = "20070923" if match = /^(\d{4})(\d{2})(\d{2}$)/.match(a) a.replace(match[1..3].join("/")) puts a end a = "20070923" a[4,0] = a[6,0] = "/" puts a E:\>ruby date.rb 2007/09/23 2007/09/23 -- Posted via http://www.ruby-forum.com/.