If you want to change date format of your system to "dd/MM/yy" format:
First add the below code to Module name "modTime":
Option Explicit
Public Const LOCALE_SLANGUAGE As Long = &H2
Public Const LOCALE_SSHORTDATE As Long = &H1F
Public Const DATE_LONGDATE As Long = &H2
Public Const DATE_SHORTDATE As Long = &H1
Public Const HWND_BROADCAST As Long = &HFFFF&
Public Const WM_SETTINGCHANGE As Long = &H1A
Public Declare Function PostMessage Lib "user32" _
Alias "PostMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long
Public Declare Function EnumDateFormats Lib "kernel32" _
Alias "EnumDateFormatsA" _
(ByVal lpDateFmtEnumProc As Long, _
ByVal Locale As Long, _
ByVal dwFlags As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32" _
Alias "RtlMoveMemory" _
(Destination As Any, _
Source As Any, _
ByVal Length As Long)
Public Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
Public Declare Function GetLocaleInfo Lib "kernel32" _
Alias "GetLocaleInfoA" _
(ByVal Locale As Long, _
ByVal LCType As Long, _
ByVal lpLCData As String, _
ByVal cchData As Long) As Long
Public Declare Function SetLocaleInfo Lib "kernel32" _
Alias "SetLocaleInfoA" _
(ByVal Locale As Long, _
ByVal LCType As Long, _
ByVal lpLCData As String) As Long
Public Function fGetUserLocaleInfo(ByVal lLocaleID As Long, _
ByVal lLCType As Long) As String
Dim sReturn As String
Dim lReturn As Long
lReturn = GetLocaleInfo(lLocaleID, lLCType, sReturn, Len(sReturn))
If lReturn Then
sReturn = Space$(lReturn)
If lReturn Then
fGetUserLocaleInfo = Left$(sReturn, lReturn - 1)
End If
End If
End Function
Public Function theEnumDates(lDateFormatString As Long) As Long
theEnumDates = 1
End Function
Private Function GetStrFromPointer(sString As Long) As String
Dim lPos As Long
Dim sBuffer As String
sBuffer = Space$(128)
Call CopyMemory(ByVal sBuffer, sString, ByVal Len(sBuffer))
lPos = InStr(sBuffer, Chr$(0))
If lPos Then
GetStrFromPointer = Left$(sBuffer, lPos - 1)
End If
End Function
Then Add Form with Command Button and add the below code in Button_click event:
Dim xCID As Long
Dim xChangedFormat As String
xCID = GetSystemDefaultLCID()
xChangedFormat = "dd/MM/yy"
If xChangedFormat <> "" Then
Call SetLocaleInfo(xCID, LOCALE_SSHORTDATE, xChangedFormat)
Call PostMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0&, ByVal 0&)
Call EnumDateFormats(AddressOf theEnumDates, xCID, DATE_SHORTDATE)
End If
ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting. ASP.NET supports three different development models: Web Pages, MVC (Model View Controller), and Web Forms.
Subscribe to:
Post Comments (Atom)
Using Authorization with Swagger in ASP.NET Core
Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models { ...
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.D...
-
<ControlTemplate x:Key="TextBoxBaseControlTemplate" TargetType="{x:Type TextBoxBase}"> <Borde...
-
<?xml version="1.0" encoding="utf-8"?> <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting...
No comments:
Post a Comment