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

[系统综合] [已解决]时间无法正确定更新请教

[复制链接]
发表于 2010-3-28 16:57:03 | 显示全部楼层 |阅读模式
本帖最后由 永远活着 于 2010-3-28 17:07 编辑

我想实现的是,在现在的时间上面修改成某一天后的时间
假如说今天是2010年3月28日,想得出五天后的时间应该就为
2010年4月1日了,在这个过程中怎么来相加这个五呢?一直搞不明白!
#include <Date.au3>
#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 222, 290, 398, 367)
$Date1 = GUICtrlCreateDate("", 16, 16, 177, 25, BitOR($GUI_SS_DEFAULT_DATE,$DTS_UPDOWN,$DTS_TIMEFORMAT))
$Input1 = GUICtrlCreateInput("", 16, 72, 49, 21)
$Label1 = GUICtrlCreateLabel("天后的时间", 72, 72, 64, 17)
$Date2 = GUICtrlCreateDate("", 16, 168, 177, 25, BitOR($GUI_SS_DEFAULT_DATE,$DTS_UPDOWN,$DTS_TIMEFORMAT))
$Button1 = GUICtrlCreateButton("读取并修改", 16, 216, 185, 57, $BS_FLAT)
$Label2 = GUICtrlCreateLabel("更新后的时间:", 16, 136, 88, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        $nowdate=StringSplit(GUICtrlRead($Date1), "-")
                        $NOWxg=$nowdate[1]&"-"&$nowdate[2]&"-"&$nowdate[3]+GUICtrlRead($Input1)
                        GUICtrlSetData($Date2,$NOWxg)
        EndSwitch
WEnd

本帖子中包含更多资源

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

×

评分

参与人数 1金钱 +10 收起 理由
afan + 10 感谢主动将修改帖子分类为[已解决],请继续 ...

查看全部评分

发表于 2010-3-28 17:01:49 | 显示全部楼层
#include <Date.au3>

$sNewDate = _DateAdd( 'd',5, '2010/03/28')
MsgBox( 4096, "", "2010/03/28 + 5 天:" & $sNewDate )
 楼主| 发表于 2010-3-28 17:06:07 | 显示全部楼层
还不知道有_DateAdd这个函数!谢谢版主
发表于 2010-3-28 17:13:48 | 显示全部楼层
新手学习中!谢谢!!
发表于 2010-3-29 10:22:04 | 显示全部楼层
学习中!谢谢!!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-7-5 11:52 , Processed in 0.078610 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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