找回密码
 加入
搜索
查看: 6324|回复: 4

[交流] [已解決]求助!關於 日期時間 計算問題???

[复制链接]
发表于 2011-9-11 14:36:15 | 显示全部楼层 |阅读模式
本帖最后由 tcpuuu 于 2012-2-22 15:56 编辑



今天是9月11日  到 10月10 日 還有幾天
#include <WindowsConstants.au3>
GUICreate('TIME',300,60)
               
$Tota7 = GUICtrlCreateLabel ("今天是",1,30,48,22)
$Tota8 = GUICtrlCreateLabel      ("",52,30,32,22,0x01)
GUICtrlSetData($Tota8,@MON & @MDAY)
$Tota9 = GUICtrlCreateLabel  ("距離",86,30,32,22)
$Tota10 = GUICtrlCreateInput("1010",120,28,40,22,0x01)
$Tota11 = GUICtrlCreateLabel("還有",162,30,32,22,0x01)
$Tota12 = GUICtrlCreateInput  ("?",196,28,24,22,0x01)
$Tota13 = GUICtrlCreateLabel  ("天",222,30,16,22,0x01)
For $i = $Tota7 to $Tota13
GUICtrlSetFont($i,12)
Next
;===============================================================================
GUISetState()

While 1
        $msg = GUIGetMsg()
        Switch $msg
                Case -3
                        Exit

EndSwitch
WEnd

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-9-11 19:54:48 | 显示全部楼层
台湾的朋友 哦,呵呵
 楼主| 发表于 2011-9-11 21:25:45 | 显示全部楼层
本帖最后由 tcpuuu 于 2011-9-11 21:27 编辑

對岸的同胞你好:
是的 我是 台灣   高雄市

希望你們看懂繁體中文字
发表于 2011-9-12 09:34:43 | 显示全部楼层
回复 1# tcpuuu
_DateDiff 
--------------------------------------------------------------------------------

根据指定的时间单位返回两个日期的经历时间.


#Include <Date.au3>
_DateDiff($sType, $sStartDate, $sEndDate)


 

参数

$sType 经历的时间单位:
D = 天数
M = 月数
Y = 年数
w = 周数
h = 小时
n = 分钟
s = 秒数 
$sStartDate 开始日期, 格式: "YYYY/MM/DD[ HH:MM:SS]" 
$sEndDate 结束日期, 格式: "YYYY/MM/DD[ HH:MM:SS]" 

 

返回值

成功: 返回两个日期的经历时间. 
失败: 返回 0 并设置 @error: 
@error: 0 - 无错误 
 1 - $sType 参数值无效 
 2 - $sStartDate 参数值无效 
 3 - $sEndDate 参数值无效 

 

备注

None.


 

相关函数

_DateAdd, _DateTimeSplit, _DateToDayOfWeek, _DateToDayOfWeekISO, _DateToDayValue, _DayValueToDate 
 

函数示例


#include <Date.au3>

; 计算 1970/01/01 00:00:00 到当前日期时间的经历秒数 
$iDateCalc = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "纪元以来的秒数: " & $iDateCalc )

; 计算今年开始到当前时间经历的小时数 
$iDateCalc = _DateDiff( 'h',@YEAR & "/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "今年到当前的小时数: " & $iDateCalc )
 楼主| 发表于 2011-9-12 10:05:39 | 显示全部楼层
謝謝版主解說  我自己有參考一個  已成功  謝謝你們

Dim $TIM = "2011/10/10"
$Tota11 = GUICtrlCreateLabel  ("還有",148,468,32,22)
$Tota12 = GUICtrlCreateInput      ("",184,466,24,22,0x01)
$Tota13 = GUICtrlCreateLabel  ("天",212,468,32,22)

$iDateCalc = _DateDiff( 'd', _NowCalc(),$TIM)
GUICtrlSetData($Tota12,$iDateCalc)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-25 04:49 , Processed in 0.072387 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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