Salut
En effet, il faut penser à l'internalisation des applis.
Pense aussi aux heures UTC.
Pour le pays, suffit d'utiliser les APIs :
Voilà un exemple :
Déclarations :
Public Enum eDateFormat
DATE_LONGDATE = &H2 ' mercredi 24 février 2010
DATE_SHORTDATE = &H1 ' 24/02/2010
End Enum
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
' http://msdn.microsoft.com/en-us/library/dd318086%28VS.85%29.aspx
Private Declare Function GetDateFormat Lib "Kernel32" Alias "GetDateFormatA" (ByVal Locale As Long, ByVal dwFlags As Long, lpDate As SYSTEMTIME, ByVal lpFormat As String, ByVal lpDateStr As String, ByVal cchDate As Long) As Long
Fonction :
Public Function FormatJapaneseDate(OsFormatedDate As Date, _
Optional DateFormat As eDateFormat = DATE_SHORTDATE) As String
' Convertit une date (seule) en date à la japonaise : Année/Mois/Jour
' Accepte n'importe quel format de date du moment que ce format est le format de l'OS
Dim mDate As SYSTEMTIME
Dim sBuffer As String
Dim r As Long
With mDate
.wDay = Day(OsFormatedDate)
.wMonth = Month(OsFormatedDate)
.wYear = Year(OsFormatedDate)
End With
sBuffer = String(255, 0)
r = GetDateFormat(LOCALE_SYSTEM_JAPAN, DateFormat, mDate, vbNullString, sBuffer, Len(sBuffer))
If r > 0 Then
FormatJapaneseDate = Left$(sBuffer, r - 1)
Else
Debug.Print Time, "(FormatJapaneseDate) La fonction renvoie " & CStr(r)
End If
End Function
Vala
Jack, MVP VB
NB : Je ne répondrai pas aux messages privés
Le savoir est la seule matière qui s'accroit quand on la partage (Socrate)