[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Parse date fields from mysql database

Bart Braem

11/8/2006 3:22:00 PM

I would like to be able to parse date fields from a MySQL database in order
to get the day, year, hour etc. separately. Which library could do that for
me? I can't think that I would have to parse those dates myself, right?

Bart
4 Answers

Gabriele Marrone

11/8/2006 3:34:00 PM

0


Il giorno 08/nov/06, alle ore 16:25, Bart Braem ha scritto:

> I would like to be able to parse date fields from a MySQL database
> in order
> to get the day, year, hour etc. separately. Which library could do
> that for
> me? I can't think that I would have to parse those dates myself,
> right?

Just use Date#day, Date#year, Date#hour and so on.

>
> Bart
>

--
Gabriele Marrone


khaines

11/8/2006 3:51:00 PM

0

Bart Braem

11/8/2006 7:26:00 PM

0

khaines@enigo.com wrote:

> parsed_time = DateTime.parse(mysql_datetime)

Combined with the methods from Gabriele this works perfectly, thanks!

Bart

Gabriele Marrone

11/8/2006 8:03:00 PM

0


On 08/nov/06, at 20:30, Bart Braem wrote:

> khaines@enigo.com wrote:
>
>> parsed_time = DateTime.parse(mysql_datetime)
>
> Combined with the methods from Gabriele this works perfectly, thanks!

Oops! Sorry, I thought you were using ActiveRecord, so it was already
parsed :)
Give it a look, of course you can use it outside Rails, if you need
it: http://rubyonrails.org/api/classes/ActiveRecord...

>
> Bart
>

--
Gabriele Marrone