[thelist] SQL/Access

aardvark roselli at earthlink.net
Mon May 14 23:23:43 CDT 2001


> From: "Daniel S. O'Shea" <doshea at surfree.com>
>
> I'm moving from Frontpage to SQL and still working locally on my

just so we're on the same page, FrontPage is a WYSIWYG HTML 
'editor,' MS SQL is a database...

> machine. After importing an Excel file into Access, the SQL query
> return from the access database is giving me the full string on the
> date/time fields. Example: 9/9/2001 for date and for time, 1:00:00 PM.
> Is there a way I can get just 9/9 returned and 1:00 PM? I tried to
> change it in Access but no matter how I change the field properties, I
> still get the full string.

well, first you can try the FormatDateTime function as such:
  FormatDateTime(varname,vbShortTime)
  FormatDateTime(varname,vbLongTime)
  FormatDateTime(varname,vbShortDate)
  FormatDateTime(varname,vbLongDate)

unfortunately, there isn't a straight Format() function in VBScript, 
unlike VB, so you have to either make do with the above, or write 
your own... like:

<% = Month(varname) & "/" & Day(varname) %>

or something similar...

anyway, yes, you can format it through SQL, but you can also do it 
via VBScript (via ASP, i don't propose you do that client side)...

> Everything else works great, would just like to get rid of the year
> and the 'seconds'.

hth...





More information about the thelist mailing list