Jump to content

Change format of Time-Control


 Share

Recommended Posts

  • Moderators

Hi,

is there a way to change the format of those Time-Controls?

I get an output like this: 00:00:00 (hour, min, sec), but seconds aren't necessary in my script.

Andi

$Time = @HOUR & ':' & @MIN & ':' & @SEC
$Time = StringTrimLeft($Time, StringInStr($Time, ':'))
MsgBox(64, 'Info', $Time)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Sorry, i don't see, what you are telling me.

This is what i meant:

#include <GuiConstants.au3>
GuiCreate("MyGUI", 392, 321,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Date_1 = GuiCtrlCreateDate("", 70, 70, 190, 20, $DTS_TIMEFORMAT)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

Posted Image

I don't want to have these seconds in this control.

Link to comment
Share on other sites

#include <GuiConstants.au3>
GuiCreate("MyGUI", 392, 321,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Date_1 = GuiCtrlCreateDate("", 70, 70, 190, 20, $DTS_TIMEFORMAT)

; to select a specific default format
$DTM_SETFORMAT = 0x1005
$style = "HH:mm"
GuiCtrlSendMsg($Date_1, $DTM_SETFORMAT, 0, $style)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

This might do the trick

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

  • Moderators

Sorry, i don't see, what you are telling me.

This is what i meant:

#include <GuiConstants.au3>
GuiCreate("MyGUI", 392, 321,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Date_1 = GuiCtrlCreateDate("", 70, 70, 190, 20, $DTS_TIMEFORMAT)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

I don't want to have these seconds in this control.

You never said you were working with a GUI! Of course you didn't get what I said then :)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Well you can for a start do it in the creation

$Date_1 = GuiCtrlCreateDate("09:45", 70, 70, 190, 20, $DTS_TIMEFORMAT)

I'll look for the GUICtrlSetData.. but read about it in the helpfile :)

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...