dis-assembling date values from access

Results 1 to 3 of 3

Thread: dis-assembling date values from access

  1. #1
    Join Date
    Dec 1969

    Default dis-assembling date values from access

    i have a date field in an access database that people on this messageboard were kind enough to help me learn how to insert custom date values into from an html form yesterday.<BR><BR>today, my challenge is to retrieve the data from the date field in access and then split the date info into three narrower fields so that asp will be able to populate my html form with my the values for its month, day, and year fields.<BR><BR>i know how to populate &#060;select&#062; fields in an html form with data from an underlying database. my problem at the moment is the step before that. specifically, i have an access field called StartDate that stores data in May/28/02 format, and I need to get vb to split the value of StartDate into the following three new variables:<BR><BR>startmonth (May format from above example)<BR>startday (28 from above example)<BR>startyear (02 from above example)<BR><BR>can anyone show me how to do this?<BR><BR>the specific code i am starting with is as follows:<BR><BR> StartDate = RecordSet( "StartDate" )<BR> startday = <BR> startmonth = <BR> startyear = <BR><BR>what do I put after the = sign to make startday, startmonth, and start year the appropriate values?

  2. #2
    Join Date
    Dec 1969

    Default RE: dis-assembling date values from access

    Look into VBScript&#039;s DatePart fiunction. A link to the VBScript docs is on the laft hand nav bar of this page, about halfway down.

  3. #3
    Join Date
    Dec 1969

    Default Better than DatePart...

    ...are the individual functions:<BR><BR>Day( )<BR>Month( )<BR>Year( )<BR>Hour( )<BR>Minute( )<BR>Second( )<BR><BR>Look into all of those instead of DatePart. Only use DatePart if the "part" you need isn&#039;t covered by one of the more specific functions (my opinion).<BR><BR>

Posting Permissions

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