# Created\_on & updated\_on - helper to display date only

**URL:** <https://www.ruby-forum.com/t/created-on-updated-on-helper-to-display-date-only/51191>\
**Category:** Rails\
**Created:** [December 27, 2005, 9:33pm UTC](https://www.ruby-forum.com/t/created-on-updated-on-helper-to-display-date-only/51191 "2005-12-27T21:33:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![afg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecc23a/32.png) [@afg](https://www.ruby-forum.com/u/afg)\
**Post date:** [December 27, 2005, 9:33pm UTC](https://www.ruby-forum.com/t/created-on-updated-on-helper-to-display-date-only/51191/1 "2005-12-27T21:33:47Z")

</div>

All,

My initial list is rather busy. I would like to shorten the  
created\_on and updated\_on fields to just display the date, not the  
time. Best wold be a simple 12/28/05 type of presentation.

I’ve found the format helpers in rdoc. (ie.  
distance\_of\_time\_in\_words\_to\_now ), but none seem to be what I’m  
looking for.

How do I control the date format of a timestamp field?

## Thanks Greg

Greg F.  
The Norcross Group  
Forensics for the 21st Century

---

<div class="post-metadata">

**Author:** ![afg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecc23a/32.png) [@afg](https://www.ruby-forum.com/u/afg)\
**Post date:** [December 27, 2005, 10:16pm UTC](https://www.ruby-forum.com/t/created-on-updated-on-helper-to-display-date-only/51191/2 "2005-12-27T22:16:02Z")

</div>

On 12/27/05, Greg F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How do I control the date format of a timestamp field?
> 
> ## Thanks Greg
> 
> Greg F.  
> The Norcross Group  
> Forensics for the 21st Century

[http://rails.rubyonrails.com/classes/ActiveSupport/CoreExtensions/Time/Conversions.html](http://rails.rubyonrails.com/classes/ActiveSupport/CoreExtensions/Time/Conversions.html)

[http://ruby-doc.org/core/classes/Time.html#M000249](http://ruby-doc.org/core/classes/Time.html#M000249)

–  
rick  
[http://techno-weenie.net](http://techno-weenie.net)

---

<div class="post-metadata">

**Author:** ![afg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecc23a/32.png) [@afg](https://www.ruby-forum.com/u/afg)\
**Post date:** [December 27, 2005, 10:34pm UTC](https://www.ruby-forum.com/t/created-on-updated-on-helper-to-display-date-only/51191/3 "2005-12-27T22:34:06Z")

</div>

On 12/27/05, Rick O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> [class Time - RDoc Documentation](http://ruby-doc.org/core/classes/Time.html#M000249)

.to\_date was exactly what I wanted, thanks.

Newbie question: I’ve got the pickaxe book and looking at the Time  
class (pg 642-649), I don’t see a .to\_date method. Am I looking in  
the wrong place, or is the book out of date?

## Thanks Greg

Greg F.  
The Norcross Group  
Forensics for the 21st Century

---

<div class="post-metadata">

**Author:** ![afg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ecc23a/32.png) [@afg](https://www.ruby-forum.com/u/afg)\
**Post date:** [December 27, 2005, 11:01pm UTC](https://www.ruby-forum.com/t/created-on-updated-on-helper-to-display-date-only/51191/4 "2005-12-27T23:01:14Z")

</div>

> > > I’ve found the format helpers in rdoc. (ie.  
> > > distance\_of\_time\_in\_words\_to\_now ), but none seem to be what I’m  
> > > looking for.
> > > 
> > > How do I control the date format of a timestamp field?
> > > 
> > > Thanks  
> > > Greg

It’s a method added by rails. Notice the first link I gave you was  
for ActiveSupport (the Rails lib that adds those niceties, and other  
things like string inflection and fixnum extensions).

–  
rick  
[http://techno-weenie.net](http://techno-weenie.net)
