Results 1 to 4 of 4

Thread: Formating Dates

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Hendersonville , NC
    Posts
    260

    Question Formating Dates

    Help .. I have a webform where the user inputs a date (04152004) and another field for time (0815).. I want to :
    1: Validate this entry..... IsDate(date) was not valid on my compile
    2: edit date output as 04/15/2004 and time as 8:15
    3: convert this date to store as 20040415

    gollnick
    William E Gollnick

  2. #2
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612
    If you are using VS .Net I suggest you use one of the Validator controls that comes with .Net.

    Of course, the date validator probably won't let them put a date in the way you have them doing it now.

    What I did was purchased a DateTime control package. It was only $50. Quite a nice little control.

    And, after they select the date, you can format it like this.

    VB Code:
    1. dteDate = format(DateTimePicker1.value,"yyyyMMdd")
    For the time thing, I would do it like this.
    VB Code:
    1. dim dteTime as time
    2. dteTime = left(strTime,2) & ":" & right(strtime,2)
    If you want the link for the datetime control I purchased, let me know.
    David Wilhelm

  3. #3
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    if you're interested in using a 3rd party control i'd recommend
    this one it's pretty customisable, very solid and best of all it's free for use in commercial projects too.

  4. #4
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612
    very solid and best of all it's free for use in commercial projects too
    Free is always better!
    David Wilhelm

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