找回密码
 加入
搜索
查看: 1908|回复: 9

[AU3基础] 有没有人研究过,只要年份和月份的日期

  [复制链接]
发表于 2018-4-8 10:27:10 | 显示全部楼层 |阅读模式
在日期里,显示的是年月日,现在想只显示年和月的日期,不知道有人研究过没有?
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 406, 206, 192, 124)
GUISetFont(12, 400, 0, "MS Sans Serif")
$Date1 = GUICtrlCreateDate("", 120, 72, 150, 21 ,BitOR($DTS_UPDOWN,$WS_TABSTOP,$DTS_LONGDATEFORMAT));
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

本帖子中包含更多资源

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

×
发表于 2018-4-8 11:03:58 | 显示全部楼层
本帖最后由 志艺风云 于 2018-4-8 12:05 编辑

在帮助中看的。应该是大写M的。
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 406, 206, 192, 124)
GUISetFont(12, 400, 0, "MS Sans Serif")
$Date1 = GUICtrlCreateDate("", 120, 72, 150, 21, BitOR($DTS_UPDOWN, $WS_TABSTOP, $DTS_LONGDATEFORMAT));
$DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW
$style = "yyyy年M月"
GUICtrlSendMsg($Date1, $DTM_SETFORMAT_, 0, $style)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        MsgBox(4096, "年月", GUICtrlRead($Date1))
                        Exit

        EndSwitch
WEnd
 楼主| 发表于 2018-4-8 11:09:15 | 显示全部楼层
回复 2# 志艺风云

太感谢你了,太牛了
 楼主| 发表于 2018-4-8 11:32:01 | 显示全部楼层
回复 2# 志艺风云


本帖子中包含更多资源

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

×
 楼主| 发表于 2018-4-8 11:45:55 | 显示全部楼层
可以了,谢谢
 楼主| 发表于 2018-4-8 12:42:27 | 显示全部楼层
回复 2# 志艺风云

还想问一个问题,如何判断时间被选中
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 350, 160, 192, 124)
$Date1 = GUICtrlCreateDate("2018/04/08", 72, 48, 186, 21,$DTS_LONGDATEFORMAT +$DTS_SHOWNONE)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
        Case $Date1
                        If BitAND(GUICtrlRead($Date1), $GUI_CHECKED) Then 
                                        MsgBox(0,'','已选中')
                        Else
                    MsgBox(0,'','未选中')
                        EndIf
        EndSwitch
WEnd
发表于 2018-4-8 16:07:32 | 显示全部楼层
没研究过,这不懂,不过这样用来干什么呢。
发表于 2018-4-8 16:20:52 | 显示全部楼层
回复 7# 志艺风云 这个可以
 楼主| 发表于 2018-4-8 16:23:59 | 显示全部楼层
回复 7# 志艺风云


    是否需要选择日期
发表于 2018-4-8 20:46:23 | 显示全部楼层
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 350, 160, 192, 124)
$Date1 = GUICtrlCreateDate("2018/04/08", 72, 48, 186, 21,$DTS_LONGDATEFORMAT +$DTS_SHOWNONE)
$Datum_hwnd = GUICtrlGetHandle($Date1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                                Case $Date1
                                         $lParam = GUICtrlRecvMsg ($Date1, $DTM_GETSYSTEMTIME, 0, 1)
                                        If Asc (StringMid ($lParam, 1, 1))=48 Then 
                                                $state = 'checked'
                                        Else
                                                $state = 'unchecked'
                                        EndIf
                                        MsgBox(0, "", $state)

        EndSwitch

WEnd
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-3-29 16:35 , Processed in 0.079012 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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