Date format with VB.NET

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 ?
 
K

Ken Tucker [MVP]

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 ?
 
C

Cor Ligthert

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top