|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
<script>
{
:global timstring
:global unixstramp
:local timstr do={
:local Date [/system clock get date];
:local Year ([:pick $Date 7 11])
:local Month ([:find jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec [:pick $Date 0 3]]);:set Month ($Month + 1);:if (1 = [:len $Month]) do={:set Month "0$Month"}
:local Day [:pick $Date 4 6]
:local nn [/system clock get time]
:set nn (([:pick $nn 0 2]) . ( [:pick $nn 3 5]) . ( [:pick $nn 6 8]))
:return ("$Year$Month$Day$nn")
}
:set timstring [$timstr]
:local secs
:local days 0
:local year ([:tonum [:pick $timstring 0 4]])
:local month ([:tonum [:pick $timstring 4 6]])
:local day ([:tonum [:pick $timstring 6 8]])
:local hh ([:tonum [:pick $timstring 8 10]])
:local mm ([:tonum [:pick $timstring 10 12]])
:local ss ([:tonum [:pick $timstring 12 14]])
:local daysarr [:toarray "31,28,31,30,31,30,31,31,30,31,30,31"]
:local unix2017 1483200000
:if ($month > 1) do={
:for i from=1 to=$month do={
:set days ($days+$daysarr->($i-1))
}
}
:if ($year>2017) do={
:for i from=2017 to=($year-1) do={
:set days ($days+1)
}
}
:set days ($days+$day-1)
:set secs ($hh*3600+$mm*60+$ss)
:set secs ($secs + $days*3600*24 + $unix2017)
:set unixstramp $secs
:put ($timstring . " " . $unixstramp)
}
</script>
主要功能是同步当前时间日期成时间戳,有需要的用,没有需要的绕过。
|
|