Development of a culture-independent birth data entry, consisting of three selected: year, month and day.
In .NET, how do I get the correct display order for three for a given culture, i.e.:
βββββββββββββββ¬ββ ββββββββββββββββ¬ββ ββββββββββββββ¬ββ
β Select year βvβ β Select month βvβ β Select day βvβ
βββββββββββββββ΄ββ ββββββββββββββββ΄ββ ββββββββββββββ΄ββ
βββββββββββββββ¬ββ ββββββββββββββββ¬ββ ββββββββββββββ¬ββ
β Select day βvβ β Select month βvβ β Select yearβvβ
βββββββββββββββ΄ββ ββββββββββββββββ΄ββ ββββββββββββββ΄ββ
or
βββββββββββββββ¬ββ ββββββββββββββββ¬ββ ββββββββββββββ¬ββ
β Select monthβvβ β Select day βvβ β Select yearβvβ
βββββββββββββββ΄ββ ββββββββββββββββ΄ββ ββββββββββββββ΄ββ
* UPDATE *
Thanks to everyone for your answers, it made me come up with this little function:
Public Function GetDateElementAtPos(ByVal pos As Integer) As String
Return Mid(Me.myCultureInfo.DateTimeFormat.ShortDatePattern.Split(Me.myCultureInfo.DateTimeFormat.DateSeparator)(pos), 1, 1).ToLower
End Function
Where myCultureInforepresents initialized Globalization.CultureInfo. I use it as follows:
Dim s as new stringbuilder
For i As Integer = 0 To 2
Select Case GetDateElementAtPos(i)
Case "y"
s.append(**year select html goes here**)
Case "m"
s.append(**month select html goes here**)
Case "d"
s.append(**day select html goes here**)
End Select
Next
source
share