From: Luis Parravicini Date: 2010-05-13T23:07:35+09:00 Subject: Re: How to append the time stamp in before file name Hi On Thu, May 13, 2010 at 7:31 AM, KingMaker KingMaker wrote: > i write code for create log file and i want to append the time stamp > before file name. > like: 0513_1552_05.logger.txt > > plz help me......!!!!!!!!! > > require 'watir' > include Watir > require 'logger' > time_stamp_s = Time.new.strftime('%m%d_%H%M_%S') > puts time_stamp_s > a="logger.txt" > log = Logger.new( 'C:\test\#{time_stamp_s}'+'.txt', 'daily' ) You get string interpolation when using double quotes. See for other cases http://www.zenspider.com/Languages/Ruby/QuickRef.html#6 So try with "C:\test\#{time_stamp_s}.txt" -- Luis Parravicini http://ktulu.com.ar/blog/