RahulOnRails
RahulOnRails

Reputation: 6542

ROR + Ruby Date in Different Format

If I have @today = Thu Apr 21 2011 00:00:00 GMT 0530 (IST),

How do I convert @today into "Thur April 21, 2011" ?

Upvotes: 0

Views: 176

Answers (1)

Spyros
Spyros

Reputation: 48606

Time.now.strftime("%a %B %d, %Y")
=> "Fri April 15, 2011"

In your occasion :

@today.to_time.strftime("%a %B %d, %Y")
=> "Thu April 21, 2011"

Upvotes: 4

Related Questions