Nh123
Nh123

Reputation: 1017

Get the current date and time

I want to get the current date and time.

For example:

2012/11/13 06:30:38

What I have tried:

Dim d As System.DateTime
MsgBox(d.Year) 'Return 1

Upvotes: 40

Views: 304352

Answers (4)

famf
famf

Reputation: 2233

use DateTime.Now

try this:

DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")

Upvotes: 79

senthilkumar2185
senthilkumar2185

Reputation: 2566

Get Current DateTime

Now.ToShortDateString()
DateTime.Now
Today.Now

Upvotes: 4

pao
pao

Reputation: 161

Try this one:

System.DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")

Upvotes: 16

user3007371
user3007371

Reputation: 41

DateTimePicker1.value = Format(Date.Now)

Upvotes: 4

Related Questions