#perl - Sun 8 Apr 2007 between 00:00 and 00:11

j0rdit's only returning the number of weeks difference between the two dates. ie. there's 2007-04-07 to 2007-08-18 there are 2 weeks between them, but there's also 4 months between them...so it should be like 18 weeks
but it's not
it's also only returning 11 days between them....because it's excluding the months
jmdKhisanth, perlxstut seems to suggest that one CAN take a random pointer and cast it to a SV*
j0rdanyone ran into this issue
i can do datemath myself..but i figured this package would have something
Caelumj0rd: maybe try $dt1->delta_md($dt2)->weeks
Khisanthjmd: where does it say that?
Caelumwhy would you cast a pointer to an SV? an SV is a data structure you have to create
jjoreCaelum: that'll return the weeks part of the duration, not weeks as a floating point.
jmdExample 6 seems to suggest it.
Caelumjjore: so ->delta_weeks?
Khisanthhrm a SVt_PV
j0rdcerridwen: gives me two weeks again
Caelum: give me two weeks again =(
Caelum: delta_weeks doesn't work either, two weeks
jjoreThere's a note in the docs that you can't always convert directly to units (like weeks) which don't have a fixed conversion unit.
lets stick with days
it returning 11 days
and not 11days + 4 months worth of days
that's with delta days
jjore->delta_days is supposed to do that.
delta_* does that.
actionjjore just had to skim the docs to know that.
jjorejust had to skim the docs to know that.
j0rdok, is there a way i can get the total amount of days between two dates wtih Date::Duration ?
exivaHello, I'm having a problem with net::IRC. For some reason I guess it's not responding to a server ping, and I don't know how to fix, and also it's not seeing a disconnect event and reconnecting. my code is here http://cugnet.net/~exiva/twtrbot.pl
Khisanthjmd: I don't see anything about casting random pointers into SV*, it says you can cast HV* and AV* into SV*
jmdKhisanth, I guess I misunderstood it then.
jjorej0rd: yeah, I don't understand why ->weeks doesn't give you that. That's what I think it should do from the docs. I guess you ought to ask the datetime list.
jmdHow do I get that pointer out again from the SV ?
j0rdjjore: thanks...this kinda sucks =(
jjore: i think it's because the duration object only stores, month => 4, days => 11...and then since it doesn't know how many days are in a month..it can't do the conversion....stupid thing
Caelumj0rd: you're doing something wrong, try: perl -MDateTime -le 'my $dt1 = DateTime->new(year=>2007,month=>4,day=>7); my $dt2 = DateTime->new(year=>2007,month=>8,day=>18); print $dt1->delta_days($dt2)->weeks'
jjoreWell... I suppose that you may need to give the duration a reference point.
Caelumj0rd: that gives me 19

Page: 2 9 16 23 30 37 44 51