TheSwamp
Code Red => VB(A) => Topic started by: Amsterdammed on July 02, 2005, 06:23:29 AM
-
Hello all together.
I have a problem with the different date version in the States and in Europe.
So is there a way I can get the today’s date in a d-m-yyyy format as return from an English Office version?
Thanks in advance,
Bernd :(
-
How about this?
Function EuroDate() As String
Dim MyDate
Dim dateVar
MyDate = Date
dateVar = Split(MyDate, "/")
MyDate = dateVar(1) & "/" & dateVar(0) & "/" & dateVar(2)
EuroDate = MyDate
End Function
Sub test()
Debug.Print EuroDate
End Sub
-
Jeff,
I just found something easy
Sub test()
Dim EDate As String
EDate = Date
EDate = Format(EDate, ("DD-MM-YYYY"))
MsgBox EDate
End Sub
I need the date also as part of a filename, so i need the - in it, no \
I just learned about the split finction, new to me.Really handy. You know VBA is pretty unknown to me.
Thanks
Bernd
-
But that works only if edate is declared as string not as date
-
Sub test()
MsgBox Format(Date, ("DD-MM-YYYY"))
End Sub
This works, too.
-
:D
or
MsgBox Format(Date, ("YYYY-MM-DD"))
-
Yep, but i needed the string for a filename, the MsgBox was just for the test.