Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
A CPAN search finds matches, including DateTime::Format::Epoch::MJD.
use DateTime::Format::Epoch::MJD qw( ); print( DateTime::Format::Epoch::MJD->parse_datetime( $mjd )->ymd(), "\n" );

But contrary to what you said 39749 is 1967-09-16. 2008-10-28 is 54767.

Update:

You can make your own DateTime::Format::Epoch derivative.

BEGIN { package DateTime::Format::Epoch::Excel; use DateTime qw( ); use DateTime::Format::Epoch qw( ); our @ISA = 'DateTime::Format::Epoch'; my $epoch = DateTime ->new( year => 1900, month => 1, day => 1 ) ->subtract( days => 2 ); # Incorrect for days before March 1st, 1900 # due to 1900 being treated as a leap year. sub new { my ($class) = @_; return $class->SUPER::new( epoch => $epoch, unit => 1/86400, type => 'float', skip_leap_seconds => 1 ); } } print( DateTime::Format::Epoch::Excel->parse_datetime( 39749 )->ymd(), "\n" );

You can use DateTime::Format::Excel.

use DateTime::Format::Excel qw( ); print( DateTime::Format::Excel->parse_datetime( 39749 )->ymd(), "\n" );

In reply to Re: Converting Julian Dates to Text by ikegami
in thread Converting Julian Dates to Text by finhagen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-25 15:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found