mIRC Home    About    Download    Register    News    Help

Print Thread
#272713 21/06/24 12:27 AM
Joined: Jun 2024
Posts: 1
W
wootage Offline OP
Mostly harmless
OP Offline
Mostly harmless
W
Joined: Jun 2024
Posts: 1
$duration($calc(60 * 60 * 24 * 365)) returns 52wks 1 day

Joined: Aug 2003
Posts: 320
P
Pan-dimensional mouse
Offline
Pan-dimensional mouse
P
Joined: Aug 2003
Posts: 320
I'm confused. 365 days is indeed 52 weeks plus 1 day. (52*7 + 1 = 365)

The help file says:
Quote
$duration(seconds,N)

Returns the specified number of seconds in a week/day/hour/minute/second format.

The N parameter is optional. If N = 2, the result does not include the seconds value. If N = 3, the result is in hh:nn:ss format.

If you are expecting "$duration($calc(60*60*24*373+3661))" to return "1yr 1wk 1day 1hr 1min 1sec" you are likely to be disappointed because it clearly states "week/day/hour/minute/second format" i.e. it does not include years.

I suspect that Khaled decided to stick with weeks because of the impossibility of handling leap years when you don't know which year(s) are covered.


Link Copied to Clipboard