The following function
DateAdd("h", -24, DateAdd("d", 1, DateValue(Now)))
gives todays date without any minutes or seconds.
How is it possible by just adding 1 day and subtracting
24 hours we get todays date without time in the result.
'Now' actually displays time along with date

Hi,

You can show only the date like this:

Dim Custom As String
        Custom = Now.ToString("MM/dd/yyyy") ' only date
        TextBox5.Text = Custom

The code I wrote is in VB6 and it is working.
I want to know the reason of that result.
ie why it gives the result without time(date only in the result)
eventhough 'Now' gives the datetime.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.