找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 6017|回复: 10

[脚本] 发个官方判断星期几的脚本

[复制链接]
发表于 2011-3-9 02:58:05 | 显示全部楼层 |阅读模式
购买主题 已有 4 人购买  本主题需向作者支付 5 铜板 才能浏览
routeros
发表于 2011-3-9 03:14:34 | 显示全部楼层
汗这么贵啊
routeros
回复

使用道具 举报

发表于 2011-3-9 03:15:05 | 显示全部楼层
太黑了把,太黑了把
routeros
回复

使用道具 举报

 楼主| 发表于 2011-3-9 03:18:10 | 显示全部楼层
没办法啊,缺钱花啊
routeros
回复

使用道具 举报

发表于 2011-3-14 00:31:39 | 显示全部楼层
这么贵啊。。。。
routeros
回复

使用道具 举报

发表于 2011-3-14 08:55:22 | 显示全部楼层
路过帮顶...没铜板...
routeros
回复

使用道具 举报

发表于 2011-3-14 09:21:51 | 显示全部楼层
  1. # Calculates day of the week for a givien date
  2. # Month: jan,feb ... nov,dec   (must be lower-case)
  3. # Day: 1 - 31
  4. # Year: 1900 - 2999
  5. # mmm/dd/yyyy   same format as [/system clock get date]
  6. # (ex. jul/22/2009)

  7. :local date [/system clock get date]



  8. # Math Calculation here
  9. :local result ""
  10. :local months [:toarray "jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec"]
  11. :local monthtbl [:toarray "0,3,3,6,1,4,6,2,5,0,3,5"]
  12. :local daytbl [:toarray "sun,mon,tue,wed,thu,fri,sat"]

  13. :local month [:pick $date 0 3]
  14. :local day [:pick $date 4 6]
  15. :local dayc [:pick $date 5 6]
  16. :local century [:pick $date 7 9]
  17. :local year [:pick $date 9 11]
  18. :local yearc [:pick $date 10 11]

  19. # if the first char is a 0 (zero) only read last char, else script fails
  20. :if ([:pick $date 4 5] = 0) do={ :set day ($dayc)}
  21. :if ([:pick $date 9 10] = 0) do=[:set year ($yearc)]

  22. :local sum 0
  23. :set sum ($sum + (2 * (3 - ($century - (($century / 4) * 4)))))
  24. :set sum ($sum + ($year / 4))
  25. :set sum ($sum + $year + $day)
  26. :for mindex from=0 to=[:len $months] do={
  27.   :if ([:pick $months $mindex] = $month) do={:set sum ($sum + [:pick $monthtbl $mindex]) }
  28. }
  29. :set sum ($sum - (($sum / 7) * 7))
  30. :set result [:pick $daytbl $sum]

  31. # END Math Calculation

  32. :put ([:pick $date 0 3] . "/" . [:pick $date 4 6] . "/" . [:pick $date 7 9] . [:pick $date 9 11] . " is on a " . $result)
复制代码
不知道是不是这个脚本
routeros
回复

使用道具 举报

发表于 2011-3-14 09:28:40 | 显示全部楼层
不知道这个脚本有什么作用的呢!
routeros
回复

使用道具 举报

发表于 2011-3-15 03:40:35 | 显示全部楼层
真够黑的。
routeros
回复

使用道具 举报

发表于 2012-11-14 20:56:49 | 显示全部楼层
感谢7楼。
不是不想买,实在是穷……
routeros
回复

使用道具 举报

发表于 2012-11-16 09:07:40 | 显示全部楼层
蔡勒公式换算而已 这也收铜板
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-6 04:54 , Processed in 0.067530 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表