Jump to content
coders-irc_Bot

$Duration farklı kullanım

Recommended Posts

  • Administrators
Posted

Benzer aktivite kullami vardır Duration ve identifiers ile. Aşağıda paylaşım yaptığım parametre seçenek ile birlikte gün saat ve dakika olarak ayrı ayrı alabilirsiniz .




Kullanımı : $dur(saniye)
Properties : days, hours, minutes
Örnek : ” //echo -a $dur(1258745) ” komutunu uyguladığınızda “ 1258745 ” saniyenin ” 14 days, 13:39 ” zaman birimine eşit olduğunu görürüz. Buda 14 gün 13 saat ve 39 dakika olduğunu söyler.

Örnek : ” //echo -a $dur(1258745).hours ” komutunu uyguladığınızda ” 13 ” verisini alırız. Burada gün ve dakika harici sadece saatin gösterilmesini sağlamış olursunuz.

 

ALIAS dur {
var %uptime.days = 0, %uptime.time
if ($regex($duration($1),/(\d+)wk/)) { %uptime.days = $calc($regml(1) * 7) }
if ($regex($duration($1),/(\d+)day/)) { inc %uptime.days $regml(1) }
var %uptime.dummy1 = $regex(hr,$duration($1),/(\d+)hr/), %uptime.dummy2 = $regex(min,$duration($1),/(\d+)min/)
%uptime.time = $+($iif($regml(hr,0),$iif($len($regml(hr,1)) == 1,$+(0,$regml(hr,1)),$regml(hr,1)),00),:,$iif($regml(min,0),$iif($len($regml(min,1)) == 1,$+(0,$regml(min,1)),$regml(min,1)),00))
if ($prop == days) return %uptime.days
if ($prop == hours) return $gettok(%uptime.time,1,58)
if ($prop == minutes) return $gettok(%uptime.time,2,58)
else { return %uptime.days $+(day,$iif(%uptime.days > 1,s),$chr(44)) %uptime.time }
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...