新手求教: 如何显示星期?
有直接显示星期的字符吗?如@min显示分那样?或者如何使用@wday显示星期?谢谢 @WDAY,多看看帮助 回复 2# netegg 这个只显示是这星期的第几天只显示1,2,3等数字 Local $Week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']MsgBox(0, 0, '今天是:' & $Week[@WDAY - 1]) MsgBox(0, '今天是', myWeek(@WDAY))
Func myWeek($iDayNum, $iShort = 0)
;==============================================
; Local Constant/Variable Declaration Section
;==============================================
Local $aDayOfWeek
$aDayOfWeek = "星期天"
$aDayOfWeek = "星期一"
$aDayOfWeek = "星期二"
$aDayOfWeek = "星期三"
$aDayOfWeek = "星期四"
$aDayOfWeek = "星期五"
$aDayOfWeek = "星期六"
Select
Case Not StringIsInt($iDayNum) Or Not StringIsInt($iShort)
SetError(1)
Return ""
Case $iDayNum < 1 Or $iDayNum > 7
SetError(1)
Return ""
Case Else
Select
Case $iShort = 0
Return $aDayOfWeek[$iDayNum]
Case $iShort = 1
Return StringLeft($aDayOfWeek[$iDayNum], 3)
Case Else
SetError(1)
Return ""
EndSelect
EndSelect
EndFunc ;==>myWeek 本帖最后由 netegg 于 2010-4-19 14:04 编辑
数字知道了,难道不会替换吗,都是唯一值, 要是用英文的星期名倒是有另一种做法,用中文的只有替换 回复 4# afan
谢谢非常感谢 哈哈
afan 真是无处不在呀!
注意哦!他是高手! afan确实是高手!
顺便拓展一下
UDF-date 里面有英文星期的相关函数#include <Date.au3>
; 给定日期的周的日序号
$iWeekday = _DateToDayOfWeek (@YEAR, @MON, @MDAY)
; 与@Wday相同
MsgBox(4096, "", "Today is a : " & _DateDayOfWeek($iWeekDay))
页:
[1]