'Day and month values swapped when displaying date on cell

I've got the following code

Sub test()

my_date = "01/09/2021  7:42"
Worksheets("Sheet1").Range("A1").Value = my_date

End Sub

This returns the following result

enter image description here

Why does it show in the cell "09/01/2021" rather than "01/09/2021" like on my original variable?

vba


Solution 1:[1]

Fixed it this way

Sub test()

Dim my_date As Date
my_date = "01/09/2021  7:42"
Worksheets("Sheet1").Range("A1").Value = my_date

End Sub

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sam