Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » Classic Visual Basic (VB 6 or earlier) » Database Programming » visual basic.net


visual basic.netExpand / Collapse
Author
Message
Posted 2/4/2010 2:31:40 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 8/20/2010 2:20:01 PM
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
Post #28825
Posted 2/4/2010 8:26:10 AM
Forum God

Forum God

Group: Moderators
Last Login: Yesterday @ 1:42:32 PM
Posts: 1,073, Visits: 9,408
not sure if this is right

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

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

Post #28827
Posted 2/6/2010 3:04:56 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 8/20/2010 2:20:01 PM
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
Post #28833
Posted 8/10/2010 1:46:09 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 11/9/2011 3:37:49 PM
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

Post #29495
Posted 11/11/2010 6:42:21 PM
Forum God

Forum God

Group: Moderators
Last Login: Yesterday @ 1:42:32 PM
Posts: 1,073, Visits: 9,408
how about

Convert.ToDateTime(DateTimePicker1.Value)

 

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

Post #29783
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Admin, Mod, Mark, Keithuk

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 2:37pm