[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

calendar event

Sushrut Sathe

4/9/2009 1:39:00 PM

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
-------------------------------------------------------------------------
--
Posted via http://www.ruby-....

2 Answers

Robert Klemme

4/9/2009 1:47:00 PM

0

On 09.04.2009 15:39, Sushrut Sathe 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

Lee Curtis

1/13/2012 4:31:00 PM

0

2849 Dead wrote:

> On Thu, 12 Jan 2012 22:18:01 -0600, David Hartung wrote:
>
> > On 01/12/2012 03:34 PM, 2849 Dead wrote:
> >> On Thu, 12 Jan 2012 13:09:35 -0800, MattB wrote:
> > >
> >>> On Thu, 12 Jan 2012 12:58:13 -0800 (PST),
> Phlip<phlip2005@gmail.com> >>> wrote:
> > > >
> >>>> On Jan 12, 12:52 pm, MattB<trdell1...@gmail.com> wrote:
> > > > >
> >>>>> I wasn't reading here then. By what I have seen for the short
> >>>>> time
> >>>>> I've been here many on the left are pro terrorist to a degree.
> > > > >
> >>>> Yeah, dude. THEY are "terrorists" when WE were the ones who
> invaded >>>> THEIR country, bombing civilians with the expressed
> intent of using >>>> terror to force political change.
> > > >
> > > >
> >>> See what I mean? Afghanistan was invaded for 9/11 and their
> >>> protection of Ben Laden long may he rot in hell.
> > >
> >> Bin Laden is dead. Why is America still in Afghanistan?
> >
> > To give you something to complain about?
>
> That's our David. "Get lots of Americans killed. It will annoy
> Zepp!"



Why is it Republicans are never happy unless US
troops are getting killed in some third world hellhole?