Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
how do i get system date in vb.net? and also i wannna store that date in my database
Posted
Comments
OriginalGriff 9-Apr-12 6:09am    
Don't repost teh same question - use the "Improve question" widget to edit your question and provide better information instead.
I have deleted the spare.

1 solution

Try:
VB
Dim today As DateTime = DateTime.Now

For DB:
VB
Using con As New SqlConnection(strConnect)
	con.Open()
	Using com As New SqlCommand("INSERT INTO myTable (myDateColumn) VALUES (@DT)", con)
		com.Parameters.AddWithValue("@DT", DateTime.Now)
		com.ExecuteNonQuery()
	End Using
End Using
 
Share this answer
 
Comments
Monjurul Habib 10-Apr-12 1:15am    
5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900