On 07.05.2008 11:08, Sunny Bogawat wrote:
> Robert Klemme wrote:
>> 2008/5/7 Sunny Bogawat <sunny_bogawat / neovasolutions.com>:
>>> i want a new file name from existing file name but with attaching time
>>>  stamp but gives error invalid argument type please tell simple way for
>>>  doing this
>> If you do not tell us what you did and what error you saw we cannot
>> help you.  Did you look at
>> http://www.ruby-doc.org/core/classes/Time.html#M000297 ?
> 
> i want  attaches a timestamps to file for this i doing Time.now_filename 
> but it gives error because time has a space sum it so i need some 
> another mechanism using which i generate timestamps and attached to 
> timestamps.

Not sure what you are really doing, I get

$ ruby -e 'Time.now_filename'
-e:1: undefined method `now_filename' for Time:Class (NoMethodError)

But Pena's solution is probably what you want.  Here's another approach:

file_name = "base_name-#{Time.now.strftime('%Y%m%d-%H%M%S')}"

Kind regards

	robert