新手求助关于时间差
如果所示,我想当我点击上面的时间的时候,我希望下面的时候跟着变动,希望下面的时候一定比上面多4小时的。求指教。。。#include <DateTimeConstants.au3>#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiDateTimePicker.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 353, 130, 399, 230)
$Date1 = GUICtrlCreateDate("2012/07/16 13:56:1", 80, 24, 186, 21,BitOR($DTS_UPDOWN, $DTS_TIMEFORMAT, $WS_TABSTOP))
_GUICTRLDTP_SETFORMAT (GUICtrlGetHandle($DATE1) , "HH:mm:ss" )
$Date2 = GUICtrlCreateDate("2012/07/16 13:56:3", 80, 80, 186, 21, BitOR($DTS_UPDOWN, $DTS_TIMEFORMAT, $WS_TABSTOP))
_GUICTRLDTP_SETFORMAT (GUICtrlGetHandle($DATE1) , "HH:mm:ss" )
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
回复 4# xyhqqaa
楼主挂个高级会员的牌子,不要老称呼自己为'新手了!
这是我乱弄出来的, 不知道合适不.#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiDateTimePicker.au3>
#include<date.au3>
#region ### START Koda GUI section ### Form=
$D = "2012/07/16 13:56:1"
$Form1 = GUICreate("Form1", 353, 130, 399, 230)
$Date1 = GUICtrlCreateDate($D, 80, 24, 186, 21, BitOR($DTS_UPDOWN, $DTS_TIMEFORMAT, $WS_TABSTOP))
_GUICtrlDTP_SetFormat(GUICtrlGetHandle($Date1), "HH:mm:ss")
GUICtrlSetData($Date1, $D)
$Date2 = GUICtrlCreateDate("2012/07/16 13:56:3", 80, 80, 186, 21, BitOR($DTS_UPDOWN, $DTS_TIMEFORMAT, $WS_TABSTOP))
_GUICtrlDTP_SetFormat(GUICtrlGetHandle($Date2), "HH:mm:ss")
GUICtrlSetState($Date2, $GUI_DISABLE)
$D2 = _DateAdd('h', 4, $D)
GUICtrlSetData($Date2, $D2)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Date1
$D = _NowCalcDate()
$D2 = _DateAdd('h', 4, $D & ' ' & GUICtrlRead($Date1))
GUICtrlSetData($Date2, $D2)
EndSwitch
WEnd 找到 _DateAdd参数了。。。嘻嘻 回复 2# xyhqqaa
刚想回复,不过看样子你能自己解决了,那就算了吧!(*^__^*) 嘻嘻…… 回复 3# 水木子
囧。。。木子哥。。。找是找到参数了。。但是发现我还不不知道怎么才好实现实时更新时间。。点击更新上面时间。。下面时间却没有跟着变跟- -!!{:1_492:} 回复 5# user3000
哥。。我水份很大的。。之前为下载。。。涮了好多水帖。。。看贡献便知。。。。正在慢慢努力脱离水军!!囧!!再次谢谢您的帮助。。。先顶了再说!! 回复 2# user3000
嘻嘻。。看明白了。。。谢谢。。。万分感谢。。。!!!! #include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiDateTimePicker.au3>
#include<date.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 353, 130, 399, 230)
$Date1 = GUICtrlCreateDate("", 80, 24, 186, 21, BitOR($DTS_UPDOWN, $DTS_TIMEFORMAT, $WS_TABSTOP))
_GUICtrlDTP_SetFormat(GUICtrlGetHandle($Date1), "HH:mm:ss")
;GUICtrlSetData($Date1, $D)
$Date2 = GUICtrlCreateDate("2012/07/16 13:56:3", 80, 80, 186, 21, BitOR($DTS_UPDOWN, $DTS_TIMEFORMAT, $WS_TABSTOP))
_GUICtrlDTP_SetFormat(GUICtrlGetHandle($Date2), "HH:mm:ss")
GUICtrlSetState($Date2, $GUI_DISABLE)
;GUICtrlSetData($Date2, _DateAdd('h', 4,_NowCalcDate()))
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Date1
$D2 = _DateAdd('h', 4,_NowCalcDate() & ' ' & GUICtrlRead($Date1))
GUICtrlSetData($Date2, $D2)
EndSwitch
WEnd这样就可以满足要求了。。。嘻嘻 回复 9# sliqi
亲,难道以后我要用小马甲问问题才不会丢高级会员的脸???囧,好像以为是高级会员就无所不能的样子。。这东西要看贡献度才现实把。。。。。郁闷天天纠结这个。。。。术业有专攻,我会的有人估计不会,我不会的别人估计会,互帮互助就这样。。。再说我专业又不是软件的。这只是兴趣。。。 能灌成高级会员也不容易呀,我现在除了码码就是灌水,还只是个可怜的注册会员{:face (229):}
求加分,求升级…… 我是刚开始学习Auto的, 1. 参照上面的代码我自己写了类似代码, 但跑不起来,2. 不理解DateAdd()函数的使用, 帮助文档是DateAdd($sType, $iValToAdd, $sDate) 就是看不懂你们写的最后一个参数, 能否帮忙解释一下, 谢谢。
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiDateTimePicker.au3>
#include <date.au3>
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("DateForm", 353, 130, 399, 230)
$Date1 = GUICtrlCreateDate("", 80, 24, 186, 21, $DTS_TIMEFORMAT)
_GUICtrlDTP_SetFormat(GUICtrlGetHandle($Date1), "HH;mm:ss")
$Date2 = GUICtrlCreateDate("", 80, 74, 186, 21, $DTS_TIMEFORMAT)
_GUICtrlDTP_SetFormat(GUICtrlGetHandle($Date2), "HH:mm:ss")
GUICtrlSetState($Date2, $GUI_DISABLE)
GUISetState(@SW_SHOW)
While 1
$nMsg =GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Date1
$D2 = _DateAdd('H', 4,_NowCalcDate() & ' ' & GUICtrlRead($Date1))
GUICtrlSetData($Date2, $D2)
EndSwitch
WEnd 支持一下,看看 楼主支持一下!!! 我没钱了 来这里借点谢谢饿 学习学习学习
页:
[1]
2