Results 1 to 4 of 4

Thread: Date and Time

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 1999
    Location
    St. Louis, MO USA
    Posts
    21

    Post

    I have code that combines the text of two text boxes. It is a date and time combination. For example

    dateplus = cdate(startdate.text & " " & stopdate.text, "mmddyyhhnn")

    now I want to break this back down to just the time to compare to another time. I need to use the time the dateplus value has accumulated and not the original time.

    In other words I need to break down and get just the time out of the date plus value in order to set a condition of it is is greater than cdate("9:59pm")

    Suggestions?

  2. #2
    New Member
    Join Date
    Oct 1999
    Location
    Amersfoort
    Posts
    15

    Post

    onlytime = cdate(dateplus, "hhnn")

    ???????

    PH


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 1999
    Location
    St. Louis, MO USA
    Posts
    21

    Post

    This did not work. we received a compile error. The compiler wants Cdate(expression) as date.

    Any other ideas?

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    To combine Date and Time Text:
    dCombined = CDate(txtDate & " " & txtTime)
    Time Part..
    sTime = Format(dCombined, "HH:NN AMPM")
    Date Part..
    sDate = Format(dCombined, "MM/DD/YYYY")



    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    adyoung@win.bright.net

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