' interpolateddate.vb Imports System Public Class CustomDateTime Shared Sub Main() Dim now As DateTime = DateTime.Now Console.WriteLine(now) ' 出力例:2004/08/24 20:23:06 Console.WriteLine(now.ToString($"{now:yyyy/MM/dd HH:mm:ss}")) Console.WriteLine(now.ToString($"{now:yyyyMMddHHmmss}")) Console.WriteLine(now.ToString($"{now:yy年MM月dd日(ddd)}")) Console.WriteLine(now.ToString($"{now:hh時mm分ss秒}")) Console.WriteLine( _ $"{now:yy年MM月dd日(dddd)} {now:hh時mm分ss秒}") ' 出力例: ' 2004/08/24 20:23:06 ' 20040824202306 ' 04年08月24日(火) ' 08時23分06秒 ' 04年08月24日(火曜日) 08時23分06秒 End Sub End Class ' コンパイル方法:vbc interpolateddate.vb