Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTime From ASP to SQL Server

Status
Not open for further replies.

scohan

Programmer
Dec 29, 2000
283
US
I've got a session variable containing a datetime value populated via 'now'. I need to query a SQL Server 7 table using the datetime value in the where clause. How do I convert the Session value (e.g., '1/22/01 12:51:18 PM') into a datetime format I can use in my SQL select statement? Thanks.
 
i would use the format() function. E.g. format(DATEVAR,"mm/dd/yyyy") (where DATEVAR is your session variable).
hope this helps...
 
When using format, I get:

I get an Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'format'

/stgpr/asp/tmp.asp, line 24

What am I missing?

Also, do you happen to know the time format I can append to the date format (e.g., ,"mm/dd/yyyy hh:mi:ss"?)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top