Ruby on Rails Thursday, February 2, 2012

On Thu, Feb 2, 2012 at 10:06 AM, amvis <vgrkrishnan@gmail.com> wrote:

now am selecting one date from table, so  from that date i  have to retrieve the day of week, day of month,year... Some ways i have tried but didn't get that, actually i had tried with current date.

       time = Time.new
       time.wday
       time.month..

so how to pass one date,which is from table and find the above stuffs..?

Time and Date are quite different. Think seriously on your business need what
you really need, a Time or a Date.

if you need a _date_ e.g. start_date of a contract, don't use Time, it will get
confusing when local time gets involved. The concept of

contract_start_date => "1 Feb 2012"

is different from the concept of

contract_start_time => "1 Feb 2012 00:00:00+00"

At contract_start_time (midnight in London) it is still 31 Jan 2011 7pm in NYC
and the contract has _not_ started yet to NY standards ...

HTH,

Peter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment