From: Hassan Schroeder Date: 2012-11-12T23:45:38+09:00 Subject: Re: Convert date to string On Mon, Nov 12, 2012 at 6:23 AM, wrote: >> t1=Time::parse(current_date+' '+current_time) I think that should be DateTime::parse, but ... > Simply use `t1 = Time.new', which returns the current system time. The OP should be aware that parsing a time out of a string value as we're doing here will, in the absence of any timezone data, assume a TZ offset of 0 (UTC/GMT). 1.9.3 (main):0 > DateTime::parse(remote_date+' '+remote_time).to_s => "2012-11-11T17:57:05+00:00" 1.9.3 (main):0 > Time.new will use the system TZ offset, e.g. -0800 for me here on the West Coast. 1.9.3 (main):0 > Time.new => 2012-11-12 06:37:58 -0800 So if you're trying to compare 2 times, make sure they're using the same TZ offset as well, or your results will be, erm, suspect :-) -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan