Sign in to follow this  
Followers 0
Phaethon

Date and Time Program

1 post in this topic

I was messing around today and decided to make a simple time/date program. It isn't that good, and it's been quite a while since I've used AutoIt so feel free to critique my code.

;~ TIME AND DATE
;~      -BY MATT
#include <GUIConstants.au3>
$main = GUICreate("Time and Date",450,100)
GUISetFont(18,600,0,"@Arial Unicode MS") 
GUISetBkColor(0x000000)
$y = 1
$time = 0
If @WDAY = 1 Then
        $day = "Sunday, "
        ElseIf @WDAY = 2 Then
        $day = "Monday,"
        ElseIf @WDAY = 3 Then
        $day = "Tuesday,"
        ElseIf @WDAY = 4 Then
        $day = "Wednesday,"
        ElseIf @WDAY = 5 Then
        $day = "Thursday,"
        ElseIf @WDAY = 6 Then
        $day = "Friday, "
        ElseIf @WDAY = 7 Then
        $day = "Saturday,"
    EndIf
    $DOM = @MDAY&", "
    $year = @YEAR
    If @MON = 1 Then
        $month = "January "
        ElseIf @MON = 2 Then
        $month = "February "
        ElseIf @MON = 3 Then
        $month = "March "
        ElseIf @MON = 4 Then
        $month = "April "
        ElseIf @MON = 5 Then
        $month = "May "
        ElseIf @MON = 6 Then
        $month = "June "
        ElseIf @MON = 7 Then
        $month = "July "
        ElseIf @MON = 8 Then
        $month = "August "
        ElseIf @MON = 9 Then
        $month = "September "
        ElseIf @MON = 10 Then
        $month = "October "
        ElseIf @MON = 11 Then
        $month = "November "
        ElseIf @MON = 12 Then
        $month = "December "
        EndIf
    $date = $day&$month&$DOM&$year  
    GUICtrlCreateLabel("Today is: "&$date,10,10)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x000000)

Do
    If @HOUR > 11 Then
        $ts = "AM"
    Else
        $ts = "PM"
    EndIf
    
    If @HOUR = 00 Then
        $hour = 12
    ElseIf @HOUR < 12 Then
        $hour = @HOUR
    ElseIf @HOUR = 12 Then 
        $hour = 12
    ElseIf @HOUR = 13 Then 
        $hour = 1
    ElseIf @HOUR = 14 Then 
        $hour = 2
    ElseIf @HOUR = 15 Then 
        $hour = 3
    ElseIf @HOUR = 16 Then 
        $hour = 4
    ElseIf @HOUR = 17 Then 
        $hour = 5
    ElseIf @HOUR = 18 Then 
        $hour = 6
    ElseIf @HOUR = 19 Then 
        $hour = 7
    ElseIf @HOUR = 20 Then 
        $hour = 8
    ElseIf @HOUR = 21 Then 
        $hour = 9
    ElseIf @HOUR = 22 Then 
        $hour = 10
    ElseIf @HOUR = 23 Then 
        $hour = 11
    EndIf
    $minute = ":"&@MIN&":"
    $second = @SEC
    $time = $hour&$minute&$second
    GUICtrlCreateLabel("The current time is: "&$time,10,50) 
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1, 0x000000)
    GUISetState()
    Sleep(1000)
        $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
    Exit
    EndIf
Until 1 = 42

Coder's Helper >> Here[center][/center]

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0