# Converting date and time formats

**URL:** <https://www.ruby-forum.com/t/converting-date-and-time-formats/111917>\
**Category:** Rails\
**Created:** [August 13, 2007, 1:40pm UTC](https://www.ruby-forum.com/t/converting-date-and-time-formats/111917 "2007-08-13T13:40:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 13, 2007, 1:40pm UTC](https://www.ruby-forum.com/t/converting-date-and-time-formats/111917/1 "2007-08-13T13:40:43Z")

</div>

Hi,

I am trying to convert the update\_at column in my database to this  
format “Fri, 10 Aug 2007 12:17:00 GMT”. How do I do this?

Kind regards,  
Dave.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 13, 2007, 1:57pm UTC](https://www.ruby-forum.com/t/converting-date-and-time-formats/111917/2 "2007-08-13T13:57:19Z")

</div>

Hi,

removed\_email\_address@domain.invalid wrote:

> I am trying to convert the update\_at column in my database to this  
> format “Fri, 10 Aug 2007 12:17:00 GMT”. How do I do this?

> > t = Time.new  
> > =\> Mon Aug 13 13:56:42 CEST 2007
> 
> > t.strftime("%a, %d %b %Y %H:%M:%S %Z")  
> > =\> “Mon, 13 Aug 2007 13:56:42 CEST”

Lutz
