# Calendar event

**URL:** <https://www.ruby-forum.com/t/calendar-event/165148>\
**Category:** Ruby\
**Created:** [April 9, 2009, 3:38pm UTC](https://www.ruby-forum.com/t/calendar-event/165148 "2009-04-09T15:38:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sushrut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@sushrut](https://www.ruby-forum.com/u/sushrut)\
**Post date:** [April 9, 2009, 3:38pm UTC](https://www.ruby-forum.com/t/calendar-event/165148/1 "2009-04-09T15:38:56Z")

</div>

In my application i use such table(table as follows) in which the  
Date\_time field by default takes (2001-07-21 11:31:00 UTC)such time  
format but i want only date, then how i remove the created\_time &  
updated\_time.  
Also how to change the format of date i want dd/mm/yyyy

* * *

creation\_id Modification\_id Delete Date\_time

## X Data N 2001-07-21 11:31:00 UTC

---

<div class="post-metadata">

**Author:** ![sushrut](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@sushrut](https://www.ruby-forum.com/u/sushrut)\
**Post date:** [April 9, 2009, 3:52pm UTC](https://www.ruby-forum.com/t/calendar-event/165148/2 "2009-04-09T15:52:20Z")

</div>

On 09.04.2009 15:39, Sushrut S. wrote:

> In my application i use such table(table as follows) in which the  
> Date\_time field by default takes (2001-07-21 11:31:00 UTC)such time  
> format but i want only date, then how i remove the created\_time &  
> updated\_time.

Then you should use class Date.

require ‘date’  
puts Date.today

> Also how to change the format of date i want dd/mm/yyyy

You should make the distinction between internal and external  
representation: internally you use a data type that properly abstracts  
“dates”. For output you transform this into a suitable format.

irb(main):008:0\> Date.today.strftime “%d/%m/%Y”  
=\> “09/04/2009”

If you internally need also time then you can use class DateTime and  
apply the same formatting:

irb(main):010:0\> DateTime.now.strftime “%d/%m/%Y”  
=\> “09/04/2009”

HTH

Kind regards

robert
