Results 1 to 5 of 5

Thread: get time from datetime

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Norwich, UK
    Posts
    405

    get time from datetime

    I have a date time value from sql server

    15/04/2005 04:15:22

    i want to get just the time in vb.net. how do i do it? is there an object i can pass the datetime too, to get the time back?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: get time from datetime

    You could use the TimeOfDay, Hour, Minute, Second properties if that were a valid datetime format string.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Norwich, UK
    Posts
    405

    Re: get time from datetime [resolved]

    thanks for the replies. i tried to reply before but my interne connection was f**ked. yeah i ended up using hour(datestring).

    i had been writing a stored proc to feed a report using reporting services
    and where i got stuck was writing an expression to filter out some results that were within a certain time range (basically in and out of office hours).

    Why didn't i do this in the sql you ask? well, i have several matrices on the one report all fed by the same stored proc, and i then use filtering in reporting services to get the right results for each matrix.

    got there in the end. thanks for the help

  4. #4
    Addicted Member
    Join Date
    Jan 2005
    Location
    Montréal
    Posts
    160

    Re: get time from datetime

    MessageBox.Show(DateTime.Now.ToString("HH:mm:ss"))
    There are no stupid questions, but a whole bunch of dumb sayings !

    Save time on database code, try DataLG !

  5. #5
    Addicted Member
    Join Date
    Jan 2005
    Location
    Montréal
    Posts
    160

    Re: get time from datetime

    c'mon, don't censure yourself
    There are no stupid questions, but a whole bunch of dumb sayings !

    Save time on database code, try DataLG !

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