Home > Software design >  Get the 'YESTERDAY DATE' - VB.NET
Get the 'YESTERDAY DATE' - VB.NET

Time:02-23

 Dim tingin As Date = DateAndTime.DateAdd(DateInterval.Day, -1, DateAndTime.Now)
 Dim trimmoto As String = Trim(tingin)
 MsgBox(trimmoto)

I want to get the 'DATE ONLY'

enter image description here

CodePudding user response:

Add :-

 Dim tingin As Date = DateAndTime.DateAdd(DateInterval.Day, -1, DateAndTime.Now)
    Dim trimmoto As String = tingin.ToString("yyyy/MM/dd")
    MsgBox(trimmoto)

Or :-

Dim tingin As Date = Now.AddDays(-1)
    Dim trimmoto As String = tingin.ToString("yyyy/MM/dd")
    MsgBox(trimmoto)
  • Related