Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Providing Fractions of a second to DateTime?

by cmv (Chaplain)
on Jun 12, 2012 at 14:25 UTC ( #975813=note: print w/ replies, xml ) Need Help??


in reply to Re: Providing Fractions of a second to DateTime?
in thread Providing Fractions of a second to DateTime?

Thanks for the pointer to nanosecond. I originally saw that and tried various things that made sense to me. For instance:

my $dt = DateTime->new(year=>$pYear, month=>$pMonth, day=>$pDay, millisecond=>$pStart, time_zone=>$tZone);
Well, that didn't work, since it doesn't take millisecond as an argument to new, so I tried converting $pStart to nanoseconds-since-midnight and substituting in that, but alas - it seems that the nanosecond value is only for providing the intra-second-delta.

See my above response to what I think I need to do. I'm hoping someone will show me a better way...


Comment on Re^2: Providing Fractions of a second to DateTime?
Download Code
Re^3: Providing Fractions of a second to DateTime?
by ansh batra (Friar) on Jun 12, 2012 at 14:32 UTC

    $dt = DateTime->new( year=>2003, month=>6, day=>12, hour=>7, minute=>22, second=>12, millisecond=>345, microsecond=>678, nanosecond=>901 );

    this should also work and use $dt->millisecond() for your calculations
    refer cpan

      i think this should also work

      It doesn't.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

        sorry tobyink my fault
        constructor doesnt support milli seconds and microseconds

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://975813]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2014-07-30 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (229 votes), past polls