TheSwamp

Code Red => VB(A) => Topic started by: Amsterdammed on July 02, 2005, 06:23:29 AM

Title: date conflict US Europe
Post 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 :(
Title: date conflict US Europe
Post by: Jeff_M on July 02, 2005, 03:32:09 PM
How about this?
Code: [Select]

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
Title: date conflict US Europe
Post by: Amsterdammed on July 02, 2005, 04:55:34 PM
Jeff,

I just found something easy

Code: [Select]



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
Title: date conflict US Europe
Post by: Amsterdammed on July 02, 2005, 04:59:40 PM
But that works only if edate is declared as string not as date
Title: date conflict US Europe
Post by: Jeff_M on July 02, 2005, 05:04:43 PM
Sub test()
MsgBox Format(Date, ("DD-MM-YYYY"))
End Sub

This works, too.
Title: date conflict US Europe
Post by: Kerry on July 02, 2005, 05:40:13 PM
:D

or

MsgBox Format(Date, ("YYYY-MM-DD"))
Title: date conflict US Europe
Post by: Amsterdammed on July 03, 2005, 02:16:08 AM
Yep, but i needed the string for a filename, the MsgBox was just for the test.