mIRC Home    About    Download    Register    News    Help

Print Thread
#259638 06/01/17 12:10 AM
Joined: Sep 2016
Posts: 33
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Could someone help change this from Weeks,days,hours,minutes,seconds To Years,months,days,hours?

alias -l TwitchTime {
if ($regex($1-, /^(\d\d(?:\d\d)?)-(\d\d)-(\d\d)T(\d\d)\:(\d\d)\:(\d\d)(?:(?:Z$)|(?:([+-])(\d\d)\:(\d+)))?$/i)) {
var %m = $Gettok(January February March April May June July August September October November December, $regml(2), 32), %d = $ord($base($regml(3),10,10)), %o = +0, %t
if ($regml(0) > 6) %o = $regml7) $+ $calc($regml(7) * 3600 + $regml(9))
%t = $calc($ctime(%m %d $regml(1) $regml(4) $+ : $+ $regml(4) $+ : $+ $regml(5)) - %o)
if ($asctime(zz) !== 0 && $regex($v1, /^([+-])(\d\d)(\d+)$/)) {
%o = $regml(1) $+ $calc($regml(2) * 3600 + $regml(3))
%t = $calc(%t + %o )
}
return %t
}
}

Last edited by Predatorfusion; 06/01/17 12:11 AM.
Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
The issue with this is that not every month has the same amount of days. I actually tried to google a solution to this problem a few months ago and only found dead links to mIRC scripts that would "convert" $duration to use years, months, days, and hours. Without writing or finding a working script to make this conversion possible, I'm afraid that the years, weeks, days, hours is as good as it's going to get. Having said that, I am also interested if anyone knows of a working script to convert mIRC's $duration to years, months, days, hours.

Blas #259656 06/01/17 11:04 PM
Joined: Sep 2016
Posts: 33
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Yeah id love to see a script for that it looks weird when it says Weeks days hours

Joined: Oct 2015
Posts: 112
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2015
Posts: 112
Well, I have found a solution to this annoyance after some more googling. A user on this forum known as "Riamus2" created a script over twelve years ago that does exactly what's needed. His website leads to a "404 error" if you click on the $DateXpander link here. However, I managed to find a pastebin of his script here.

Moving on, I was still not 100% happy with the outcome when getting the length of time that a user has followed for. I felt that replies such as:
Quote:
User has been following this channel for 1 year, 7 months, 2 weeks, 2 days, 23 hours, 34 minutes, and 14 seconds since May 24 2015.
were too long for my liking. If that is what you want, I recommend grabbing the script from the pastebin above.

I wanted to shorten the reply. I did some basic editing to the script to have it like follows. For anyone that has been following for LESS than ONE day, the reply will use HOURS, MINUTES, and SECONDS.
Quote:
User has been following this channel for 8 hours, 17 minutes, and 25 seconds since Jan 10 2017.

For anyone that has been following for one day or more, the reply will use YEARS, MONTHS, WEEKS, and DAYS.
Quote:
User has been following this channel for 1 year, 7 months, 2 weeks, and 2 days since May 24 2015.

You can find my edit at this link if interested. I hope this helps someone!


Link Copied to Clipboard