How do I convert an int to a date?

D

dlehman

I have an int (which is actually a Julian Day Number value) which I
want to convert to an actual date value. How do i do this?

..to_date() does not do what I want, but there must be something like
this. I'm just not sure what to look for.
 
C

Christophe Grandsire

I have an int (which is actually a Julian Day Number value) which I
want to convert to an actual date value. How do i do this?

..to_date() does not do what I want, but there must be something like
this. I'm just not sure what to look for.

Is the class method Date::jd what you're looking for? It takes a Julian
Day Number and returns a Date object. It has an optional parameter for
the Day of Calendar Reform (defaults to Date::ITALY, but you can also
use Date::England). Once you have the Date object, you can use its
methods to convert to any shape you want :) .

You should check the Date methods at http://www.ruby-doc.org/core/ . I'm
pretty sure you'll find there exactly what you need.
--
Christophe Grandsire.

http://rainbow.conlang.free.fr

You need a straight mind to invent a twisted conlang.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,966
Members
47,515
Latest member
Harvey7327

Latest Threads

Top