'Dim dt0 As Date = #12/31/2000 12:34:56.789# 'これはエラー Dim dt1 As Date = #12/31/2000 12:34:56# Dim dt2 As Date = #12/31/2018 12:34:56 PM# Dim dt3 As Date = #2000/12/31 12:34:56# 'VB2015以降のみ
MsgBox(Now.ToString("ss.fffffff")) Dim s1 As String = Now.ToString("#MM/dd/yyyy HH:mm:ss.fffffff#") Dim s2 As String = String.Format("#{0:MM/dd/yyyy HH:mm:ss.fffffff}#", Now) Dim s3 As String = Now.ToString("\#MM/dd/yyyy HH:mm:ss.fffffff\#", CultureInfo.InvariantCulture) Dim s4 As String = String.Format(CultureInfo.InvariantCulture, "#{0:MM/dd/yyyy HH:mm:ss.fffffff}#", Now) Dim s5 As String = $"#{Now:MM/dd/yyyy HH:mm:ss.fffffff}\#" 'VB2015以降
Dim s1 As String = dt.ToString("fffffff") Dim s2 As String = dt.ToString("ss.fffffff") Dim nanoSec As Integer = CInt(dt.Ticks Mod 10000000L) * 100 Dim sec As Decimal = ((dt.Ticks Mod 10000000L) / 10000000D) + dt.Second