Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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 12th, 2004, 04:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default Date String

How can display date string value ?
I want to display date like this.

12 May 2004

strdate=Request.Form("strdate")
Response.write(strdate)

I use sql server 2000, how can use the strdate in the following
function so that it return string date in asp page
ie. 12 May 2004

what is the syntax to display string date in asp ?


convert(varchar(2),day(getdate())) + ' ' + DATENAME(month, getdate()) + ' ' + convert(varchar(4),year(getdate()))


regards.

Mateen



 
Old May 12th, 2004, 04:53 AM
Registered User
 
Join Date: Nov 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Ramanuj Send a message via Yahoo to Ramanuj
Default

select CONVERT(varchar, getdate(), 106 ) AS 'DATE'

;) enjoy

 
Old May 12th, 2004, 05:25 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for response.

how can display the date in ASP page ?
i.e. 12 May 2004


it is display date in sql server,

Mateen





Quote:
quote:Originally posted by Ramanuj
 select CONVERT(varchar, getdate(), 106 ) AS 'DATE'

;) enjoy

 
Old May 12th, 2004, 05:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can use

Day()
MonthName(month[,abbreviate])
Year()

functions to get that.

-Vijay G
 
Old May 12th, 2004, 05:43 AM
Registered User
 
Join Date: Nov 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Ramanuj Send a message via Yahoo to Ramanuj
Default

day(now) & " " & monthname(month(now), True) & " " & year(now)

;)

 
Old May 12th, 2004, 06:10 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks.


Quote:
quote:Originally posted by Ramanuj
 day(now) & " " & monthname(month(now), True) & " " & year(now)

;)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Validation from String iceandrews XSLT 4 May 14th, 2008 07:25 AM
how to convert string to date tgopal Javascript 2 March 18th, 2008 03:33 AM
Conversion from string to date kshantik Access 2 May 19th, 2004 12:17 PM
DTS Import ( Date string to Date field) gfowajuh SQL Server 2000 1 September 30th, 2003 06:28 AM
Convert String Date to Date for a SQL Query tdaustin Classic ASP Basics 4 July 7th, 2003 06:01 PM





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