31 lines
816 B
Plaintext
31 lines
816 B
Plaintext
include::../why-dotnet.adoc[]
|
|
|
|
include::../impact-dotnet.adoc[]
|
|
|
|
include::../how-dotnet.adoc[]
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,vbnet,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
Private Sub PrintTime()
|
|
Console.WriteLine(DateTime.UtcNow.ToString("dd/MM/yyyy HH:mm:ss"))
|
|
|
|
Console.WriteLine(DateTime.UtcNow.ToString("dd/mm/yyyy HH:MM:ss")) ' Months and minutes have changed their places
|
|
End Sub
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,vbnet,diff-id=1,diff-type=compliant]
|
|
----
|
|
Private Sub PrintTime()
|
|
Console.WriteLine(DateTime.UtcNow.ToString(CultureInfo.GetCultureInfo("es-MX")))
|
|
|
|
Console.WriteLine(DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)) ' Better provide a well known culture, so this kind of issues do not pop up
|
|
End Sub
|
|
----
|
|
|
|
include::../resources-dotnet.adoc[] |