Results 1 to 4 of 4

Thread: How do I combine a date and a time (RESOLVED)

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    How do I combine a date and a time (RESOLVED)

    I have two time pickers, one for Date, and one for time. Now I want to store the results in one DateTime object.

    So I have a say 6/30/2004 12:00:00am date

    and a 6/23/2004 3:33:00 am time, and I want

    6/30/2004 3:33:00 am
    Last edited by SeanGrebey; Jun 23rd, 2004 at 11:20 AM.
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    Ok, that is kind of silly, I have to append the Date to the Time Span.....
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  3. #3
    Hyperactive Member CyberHawke's Avatar
    Join Date
    May 2004
    Location
    Washington DC
    Posts
    477
    you could also try this:

    VB Code:
    1. Dim t1 As DateTime = Date.Parse("6/30/2004 12:00:00 am")
    2.         Dim t2 As DateTime = Date.Parse("6/23/2004 3:33:00 am")
    3.         Dim t3 As String = t1.Date.ToString
    4.         Dim t4 As String = t2.TimeOfDay.ToString
    5.         Dim t5 As DateTime = Date.Parse(t3 & t4)
    6.         MessageBox.Show(t5)

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    I just used:

    dtDateTime = DatePicker1.Value.Date.ToString & DatePicker2.Value.TimeOfDay.ToString
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width