Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


visual basic.net


visual basic.net

Author
Message
tawfiiq
tawfiiq
Forum God
Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)

Group: Forum Members
Posts: 2, Visits: 15
hi dear



i am new to vb.net , and i want to add date and time (DateTimePicker1) to my form

then when i save the record a wrong date is saved to the table , my database is sql 2005





Code: " & Format(DateTimePicker1.Value, "dd/mm/yy") & ") "



Result: 1/1/1900 12:00:00 AM



i much liked to help.............


amaan
Mark
Mark
Forum God
Forum God (141K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
not sure if this is right

DateTimePicker1.Value.ToString("dd/mm/yy")

you will probably do better posting in the Visual Basic .NET forum

tawfiiq
tawfiiq
Forum God
Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)Forum God (834 reputation)

Group: Forum Members
Posts: 2, Visits: 15
hi



i had tried this code



DateTimePicker1.Value.ToString("dd/mm/yy")



but still not solved to my problem and producing same result:1/1/1900 12:00:00 AM

for any time to save record.



i hope help




amaan
Raghu
Raghu
Forum God
Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)Forum God (1.2K reputation)

Group: Forum Members
Posts: 5, Visits: 6

You can do something like this

In design time you can change the format to Short Date

Format(DateTimePicker1.Value, "dd/MM/yy")

 

Hope this helps


Mark
Mark
Forum God
Forum God (141K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
how about

Convert.ToDateTime(DateTimePicker1.Value)

 

EDIT: Never mind...I just noticed the date.


Edited
11/11/2010 by Mark
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search