Timestring

  • Thread starter Thread starter N! Xau
  • Start date Start date
N

N! Xau

Hi,

timestring() returns current time in format hh:mm:ss.
Any simple way to get also the fractions of a second? (hh:mm:ss:cc)

thanks
N! Xau
 
If you use the SYSTEMTIME Structure you will be able to get milliseconds

Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential)> _
Public Structure SYSTEMTIME
Public wYear As Short
Public wMonth As Short
Public wDayOfWeek As Short
Public wDay As Short
Public wHour As Short
Public wMinute As Short
Public wSecond As Short
Public wMilliseconds As Short
End Structure

Private Declare Sub GetSystemTime Lib "kernel32" Alias "GetSystemTime"
(ByRef lpSystemTime As SYSTEMTIME)


Dim sysTime As SYSTEMTIME
GetSystemTime(sysTime)
MessageBox.Show(sysTime.wMilliseconds.ToString())

The above just shows the milliseconds, as I haven't coded any other part of
the time. You will be able to do that

I hope the above helps

Crouchie1998
BA (HONS) MCP MCSE
 
N,

I am curious, time strings are mostly based on typed text otherwise there is
a datetime structure choosen. By instance the ticks, which is a long value,
representing in dotNet the dateTime from the start of the time accoording to
the Georgian calandar.

Are people where you live able to type in fractions of seconds?

Cor
 
Why go through all that trouble?

DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ff")
 
Crouchie1998 said:
Private Declare Sub GetSystemTime Lib "kernel32" Alias "GetSystemTime"

The alias is not really useful ;-).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top