Date format with VB.NET

  • Thread starter Thread starter sympatico
  • Start date Start date
S

sympatico

have the following code:
Dim dd, mm, yy, sDate As String

Dim dDate, dDateF As Date

Dim Format As New System.Globalization.CultureInfo("fr-FR", True)

dDate = Today

dd = CStr(dDate.Day)

mm = CStr(dDate.Month)

yy = CStr(dDate.Year)

sDate = dd & "/" & mm & "/" & yy

dDateF = System.DateTime.P****(sDate, Format,
Globalization.DateTimeStyles.None)



I'm expecting to have a date in dDateF with the french format but I get the
US one!

How to solve it ?
 
Hi,


The datetime is formatted as it is displayed.
Me.Text = Now.ToString("D", New Globalization.CultureInfo("fr-FR", True))



Ken

-----------------------

have the following code:
Dim dd, mm, yy, sDate As String

Dim dDate, dDateF As Date

Dim Format As New System.Globalization.CultureInfo("fr-FR", True)

dDate = Today

dd = CStr(dDate.Day)

mm = CStr(dDate.Month)

yy = CStr(dDate.Year)

sDate = dd & "/" & mm & "/" & yy

dDateF = System.DateTime.P****(sDate, Format,
Globalization.DateTimeStyles.None)



I'm expecting to have a date in dDateF with the french format but I get the
US one!

How to solve it ?
 
Sypatico,

In the IDE is the US date showed for DateTime and Date when you are
debugging.

However when displayed as "toString" it goes to the ones as used in your
culture.

I hope this helps?

Cor

"sympatico">
have the following code:
 
Back
Top