| j0rd | it'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 |
| jmd | Khisanth, perlxstut seems to suggest that one CAN take a random pointer and cast it to a SV* |
| j0rd | anyone ran into this issue i can do datemath myself..but i figured this package would have something |
| Caelum | j0rd: maybe try $dt1->delta_md($dt2)->weeks |
| Khisanth | jmd: where does it say that? |
| Caelum | why would you cast a pointer to an SV? an SV is a data structure you have to create |
| jjore | Caelum: that'll return the weeks part of the duration, not weeks as a floating point. |
| Caelum | oh |
| jmd | Example 6 seems to suggest it. |
| Caelum | jjore: so ->delta_weeks? |
| Khisanth | hrm a SVt_PV |
| j0rd | cerridwen: gives me two weeks again Caelum: give me two weeks again =( Caelum: delta_weeks doesn't work either, two weeks =( |
| jjore | There'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. |
| j0rd | well lets stick with days it returning 11 days and not 11days + 4 months worth of days that's with delta days ->delta_days |
| jjore | ->delta_days is supposed to do that. delta_* does that. |
| action | jjore just had to skim the docs to know that. |
| jjore | just had to skim the docs to know that. |
| j0rd | ok, is there a way i can get the total amount of days between two dates wtih Date::Duration ? |
| exiva | Hello, 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 |
| Khisanth | jmd: I don't see anything about casting random pointers into SV*, it says you can cast HV* and AV* into SV* |
| jmd | Khisanth, I guess I misunderstood it then. |
| jjore | j0rd: 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. |
| jmd | How do I get that pointer out again from the SV ? |
| j0rd | jjore: 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 |
| Caelum | j0rd: 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' |
| Khisanth | INT2PTR(SvUV(sv)) |
| jjore | Well... I suppose that you may need to give the duration a reference point. |
| Caelum | j0rd: that gives me 19 |