Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
Public Class Class1
<StructLayout(LayoutKind.Sequential)> _
Private Structure SYSTEMTIME
<MarshalAs(UnmanagedType.U2)> Public Year As Short
<MarshalAs(UnmanagedType.U2)> Public Month As Short
<MarshalAs(UnmanagedType.U2)> Public DayOfWeek As Short
<MarshalAs(UnmanagedType.U2)> Public Day As Short
<MarshalAs(UnmanagedType.U2)> Public Hour As Short
<MarshalAs(UnmanagedType.U2)> Public Minute As Short
<MarshalAs(UnmanagedType.U2)> Public Second As Short
<MarshalAs(UnmanagedType.U2)> Public Milliseconds As Short
End Structure
<DllImport("kernel32.dll")> _
Private Shared Sub GetLocalTime(ByRef time As SYSTEMTIME)
End Sub
Public Sub test1()
Dim currenttime As SYSTEMTIME
GetLocalTime(currenttime)
Console.WriteLine("day: {0}", currenttime.Day)
Console.WriteLine("dayofweek: {0}", currenttime.DayOfWeek)
Console.WriteLine("month: {0}", currenttime.Month)
Console.WriteLine("year: {0}", currenttime.Year)
Console.WriteLine("hour: {0}", currenttime.Hour)
Console.WriteLine("minute: {0}", currenttime.Minute)
Console.WriteLine("second: {0}", currenttime.Second)
Console.WriteLine("milliseconds: {0}", currenttime.Milliseconds)
End Sub
End Class
Alternative Managed API:
Do you know one? Please contribute it!
System.DateTime.Now
Retrieves the current system date and time in Coordinated Universal Time (UTC) format. To retrieve the current system date and time in local time, use the GetLocalTime function
3/30/2023 2:32:51 PM - -84.131.214.178
Represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.
9/30/2021 1:01:31 PM - -45.137.113.229
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).