Format of dates. HELP!

Results 1 to 4 of 4

Thread: Format of dates. HELP!

  1. #1
    Big Mac Guest

    Default Format of dates. HELP!

    Hi,<BR><BR>In Access97, field "CS_DATE" is defined as shortDate and is yyyy-mm-dd. In my asp page, I&#039ve use : <BR><BR>&#062;dim sStartDate<BR>&#062;sStartDate = FormatDateTime(objRS.fields("CS_DATE"), vbShortDate)<BR><BR>and the value I get is mm-dd-yy. How do I output yyyy-mm-dd??? Also, (once the date thing is solved) if the user changes the date (using the above format) and updates the DB using EDIT and UPDATE, will Access automatically know it is a date??<BR><BR>Thanks.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Format of dates. HELP!

    To format the date as you need it, use the following.<BR><BR>Dim theDay, theMonth, theYear, theWholeThing<BR><BR>theDay = Day(objRS.fields("CS_DATE"))<BR>theMonth = UCase((Left(MonthName(Month(objRS.fields("CS_DATE" ))), 3)))<BR>theyear = Year(objRS.fields("CS_DATE"))<BR><BR>&#039 Now concatenate them together<BR>theWholeThing = theYear& "-" & theMonth & "-" & theDay<BR><BR>Response.Write theWholeThing<BR><BR>I believe this will solve the problem.<BR><BR>HTH<BR><BR>Jerry

  3. #3
    Big Mac Guest

    Default RE: Format of dates. HELP!

    Thanks Jerry, it works great! Just one thing though, how do I get single digit days to appear as dd (ie. 2000-01-05 rather then 2000-01-5

  4. #4
    Big Mac Guest

    Default Problem Solved!


Posting Permissions

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