Jump to content
Sign in to follow this  
jeweetwel

Cant get the month from a date

Recommended Posts

jeweetwel

Hello,

I'm new to AutoIt...

I´m a bit lost. :( ... Is there any way to extract the month from the date and time picker?

I created a dtpicker:

$date_now = @MDAY&"-"&@MON&"-"&@YEAR

$MonthCal1 = GUICtrlCreateMonthCal($date_now, 16, 16, 193, 180)

When the user chooses a different date, i want to read it, and, if possible, i want the values seperatly. (day - month - year).

I spent several hours :sweating: trying to find the answer, and this can't be so difficult i guess. (This is very simple in VB..)

Anyone???

Thanks in advance, and sorry for the poor english.

Best regards,

Rody

Share this post


Link to post
Share on other sites
Jos

So what did you do to read the value from the date control?

Did you use GuiCtrlRead() as shown in the Helpfile Example?

Nederlands werkt ook voor mij. ;)


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
jeweetwel

Hello (hallo) Jos,

Bedankt voor je reactie.

Ja, heb ik gedaan, dat werkt ook wel, maar hoe haal ik de maand uit de datum??

Voel me lullig dit te moeten vragen overigens. Ben nog nooit echt met auto it bezig geweest, nu probeer ik het weer een beetje op te pakken, maar dat kost zo meer tijd dan ik er mee ga besparen.....

Gr,

Rody

Share this post


Link to post
Share on other sites
Jos

Something to play with:

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $Date, $msg
    GUICreate("Get date", 210, 190)

    $Date = GUICtrlCreateMonthCal("1953/03/25", 10, 10)
    GUISetState()

    ; Run the GUI until the dialog is closed or timeout

    Do
        $msg = GUIGetMsg()
    Until $msg = $GUI_EVENT_CLOSE

    ConsoleWrite('Returned Date = ' & GUICtrlRead($Date) & @CRLF)
    $adate = StringSplit(GUICtrlRead($Date), "/")
    ConsoleWrite(" Year=" & $adate[1] & @CRLF)
    ConsoleWrite(" Month=" & $adate[2] & @CRLF)
    ConsoleWrite(" Day=" & $adate[3] & @CRLF)

EndFunc   ;==>Example

Jos ;)


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
jeweetwel

Hello Jos,

Thanks a lot. I see you split the "string". There is no other function available in AutoIt to do this like in VB?

This will help me a lot by the way, thanks for sharing.

Best regards, (met vriendelijke groet),

Rody

Share this post


Link to post
Share on other sites
Jos

Sure there are many other options:

_StringBetween()

StringRegExp()

StringInstr() + StringMid()

..but just used this one this time as it seemed to be the easiest one, which by the way is also available in VB (SPLIT()) :)

Groet,

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
skin27

Rody, welke functie's gebruik je dan in VB?

Edited by skin27

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  

  • Similar Content

    • Jewtus
      By Jewtus
      I'm trying to find out if there is a way of changing the background/font/style of specific days within a GUICtrlCreateMonthCal. I want to be able to mark events on the days and have it display the information in a subtle way (kinda like Google calender). I also want to ultimately integrate the outlook calender.
      Here is a base:
      #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $GuiCalender = GUICreate("Calendar", 225, 154, 390, 213) $MonthCal1 = GUICtrlCreateMonthCal("", -56, -56, 337, 260) GUISetState(@SW_SHOW) GuiCtrlSet While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
×