Jump to content

Recommended Posts

Posted

I like the "GuiCtrlCreateDate" to show the Pre-Selected date from a key in the register. But it only shows the date from today.

I tried different appoaches but so far without any luck

Here's alittle piece from my script:

$Date = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\DateCrackerDL\"& $ProgramName, "Date")
; some GUI create code
$Date_1 = GuiCtrlCreateDate("", 220, 50, 160, 20)
GUICtrlSetData(-1, $Date)

I also tried:

$Date_1 = GuiCtrlCreateDate($Date, 220, 50, 160, 20)

But nothing seems to work. :idiot:

Can someone help me please. :D

Posted

OK, I found a thing which is probably causing this.

The date which has to be entered is given as: YYYY-MM-DD (english style)

The $Date of my PC is: DD-MM-YYYY (dutch style)

Can the preselected date for this GUIsetting also be set as DD-MM-YYYY ???

  • 2 months later...
Posted

OK, I found a thing which is probably causing this.

The date which has to be entered is given as: YYYY-MM-DD (english style)

The $Date of my PC is: DD-MM-YYYY (dutch style)

Can the preselected date for this GUIsetting also be set as DD-MM-YYYY ???

<{POST_SNAPBACK}>

That's correct. Except no one in Britian uses YYYY-MM-DD. It's not an English style.

YYYY-MM-DD is actually the ISO 8601 date format. It's sometimes called the international date format etc.

Posted

definitely not American :lmao:

I don't think there's a way to have it MM-DD-YYYY without editing the _date function entirely. If you'd prefer, I'd rather just use this function I made:

Func ReFormatDate($date)
    $date_split = (StringSplit($date, "/" & "-" & "\"))
; If single digit, prepend 0
    For $n = 1 to 9
        If $date_split[1] == $n Then $date_split[1] = ("0" & $date_split[1])
    Next
    For $n = 1 to 9
        If $date_split[2] == $n Then $date_split[2] = ("0" & $date_split[2])
    Next
    $date = ($date_split[3] & "/" & $date_split[1] & "/" & $date_split[2])
    Return ($date)
EndFunc

It's worked so far, just input the date in MM/DD/YYYY or MM-DD-YYYY or MM\DD\YYYY as such:

$old_date = "05/17/2005"
$new_date = ReFormatDate($old_date)
MsgBox(0,"Date","This changes " & $old_date & " to " & $new_date)
Exit

Let me know if you have problems, I've only tested it with an input box and GUICtrlRead --> GUICtrlSetData (to change the date), but it works well for me so far

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
  • Recently Browsing   0 members

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