mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2021
Posts: 34
T
Ameglian cow
OP Offline
Ameglian cow
T
Joined: Jan 2021
Posts: 34
I have tried DateXpander. Which can be found here: https://forums.mirc.com/ubbthreads....uration-include-months-years#Post126269.
Changed the code to calculate out 31, which is the end of the year here in my Country.
But always it return 1 day till end of the year.

So I tried to code this from the ground. The snippet below should return 2 days, but in mIRC it returns 1 day.
Code
alias EndOfYear {
  ; Calculate the end of the year time
  var %end_of_year $ctime($asctime(yyyy) $+ /12/31 00:00)

  echo -ag $duration($calc(%end_of_year - $ctime))
}

I'm totally lost, maybe I code wrong?
I have not used MSL since a long time ago.

Joined: Nov 2021
Posts: 126
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 126
if im correct 31 december 00:00 doesnt exist as 00:00 midnight would already be 01 january

Joined: Jan 2005
Posts: 193
Vogon poet
Offline
Vogon poet
Joined: Jan 2005
Posts: 193
31 december 00:00 most definitely exists!
It is followed one second after 30 december 23:59

--
If you want to calculate to new year then try doing it to 31 december 23:59, or even better to 1 january 00:00


echo -a $signature
Joined: Jul 2006
Posts: 4,211
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,211
If that were true if would have an even bigger gap.
31 of December 00:00 comes after 30 of december 23:59:59.
So, he should have been using January first instead of December 31.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2021
Posts: 126
Vogon poet
Offline
Vogon poet
Joined: Nov 2021
Posts: 126
Yea that's true i forgot about 12 am between 30 and 31 December but that would not be what he was after neither, but 31dec 23:59:59 would work fine tho.

Joined: Aug 2023
Posts: 8
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
Joined: Aug 2023
Posts: 8
i didn't look at the link you got your code from but this should work

Code
alias endofyear {
  var %newyear $ctime($calc($asctime(yyyy) + 1) $+ /01/01 00:00:00)
  echo -ag $duration($calc(%newyear - $ctime))
}

hope this helps


incorrigo syx
- text based virtual world -

Link Copied to Clipboard