Results 1 to 5 of 5

Thread: [RESOLVED] Date Time Picker - Remove Time

  1. #1

    Thread Starter
    Fanatic Member The_Grudge's Avatar
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    836

    Resolved [RESOLVED] Date Time Picker - Remove Time

    I have a bunch of datetime pickers on my form.

    When I step through my program using F8 I notice that when the dtPicker is not changed by the user it writes a value to the database such as "07/25/2005".

    The problem I'm having is that when the user changes the date on the dtPicker it shows up in the program as "07/25/2005 9:40:45AM" which is not working because my database field is not a datetime.

    How can I trim the time off the end?

    Is there a property that does this or do I have to resort to something like a MID or LEFT function to get the values I want?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Date Time Picker - Remove Time

    You should be able to just format it.
    VB Code:
    1. DTPicker1.Value = Format(DTPicker1.Value, "mm/dd/yyyy")

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Date Time Picker - Remove Time

    In design mode, select the date picker. Press F4 to get the Properties window. Scroll all the way to the top of the Props window. There's one called "Custom" click the "..." button that's there (you may have to actualy select the property before it shows I think).

    A new dialog screen should pop up. There's a checkmark that controls if the date shoudl be displayed or not. Clear it. Set any other props you want. Click OK (or it may be close, I can't remember off the top of my head.) Yuo should be OK after that. If you are using the .Value property to get the date selected, it may still contain the time, just simply use the Format function to return only the date.

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Fanatic Member The_Grudge's Avatar
    Join Date
    Jan 2005
    Location
    Canada
    Posts
    836

    Re: [RESOLVED] Date Time Picker - Remove Time

    Thanks Hack...worked like a charm.

    That was such an easy fix I never thought of it!

  5. #5
    Lively Member
    Join Date
    Aug 2005
    Posts
    81

    Re: [RESOLVED] Date Time Picker - Remove Time

    Hi..............

    Date Time Picker has its Format property set it to

    1 - dtpShortDate

    it will give u value of datepicker in mm/dd/yyyy format

    I think it will solve your problem. If this is the solution or ur problem then Please let me know ?

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