Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 29th, 2006, 07:47 AM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DATE from DATETIME

i want to extract the date alone from the sqlserver using ASP
 
Old May 30th, 2006, 10:29 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

Why do you need the date from SQL server? You can get the date in ASP with Date() or Now(). Date will give you the short date and Now will give you long date.

For MS-SQL :

SELECT getDate()

 
Old May 30th, 2006, 11:02 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am assuming you are reading a datetime from sql server, and you are interested in the date portion, and want to ignore the time portion.

There are several ways to do this, here is one:
- Let's assume you are reading the value from a recordset named rs with a field named "MyDate"
reposne.write Int(rs("MyDate"))))






Woody Z http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need ONLY date in datetime field in Database Lucy SQL Server 2000 10 April 30th, 2007 09:20 AM
Datetime to Date during Query krashed SQL Language 1 April 4th, 2006 11:59 PM
Compare only the date portion of a datetime field CricketMaster Access 6 April 27th, 2005 01:06 AM
Seperating Date part from a datetime field ctranjith SQL Server 2000 2 October 25th, 2004 06:42 AM
Getting Date part out of Datetime in Stored Pr pavel SQL Server 2000 3 February 18th, 2004 04:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.