Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 10th, 2008, 12:38 PM
Registered User
Join Date: Apr 2008
Location: , , .
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Default How to pull Month & Year from Date(dd/mm/yyyy)

I am very new web Development using ASP VB, and I having a problem with SQL. What I try to do is I have the news records in access and I want to pull the news records by select Month and Year from Date(dd/mm/yyyy) field in asp page how to do that??

please help!!!

Reply With Quote
  #2 (permalink)  
Old April 10th, 2008, 06:11 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41

Your question is not that clear. Do you mean GROUP BY month and year? You need to explain your self better. make sure you know the difference between SELECT, ORDER and GROUP. Refer to these in your question, give examples if you have to.

BTW - This question would suit the SQL area of the forum...

Wind is your friend
Reply With Quote
  #3 (permalink)  
Old April 22nd, 2008, 06:22 PM
Authorized User
Join Date: Apr 2008
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts

It sounds like you could use the datepart function. You're talking about news, so lets say in your db you have a column named "story" that holds the title of the news story and another column named "story_date" that hold the corresponding date of each story. Now, lets say you wanted to list all of the story titles that were from 2007. You could use:

SELECT story FROM tablename WHERE DATEPART('yyyy', story_date)=2007;

This would display data only from the "story" column where its date in the "story_date" colum was from 2007.

You could also use...('m',x)=z for months. Where "x" would be the data you wish to base your month on and "z" would be the actual month (use a number).

You should be able to combine two queries to get what you're looking for.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert dd/MM/yyyy to MM/dd/yyyy Rg2005 VB.NET 2002/2003 Basics 2 November 7th, 2008 06:42 PM
Date dd-mm-yyyy John2112 SQL Server 2000 2 March 16th, 2007 05:15 AM
Converting short date to show mm/dd/yyyy crabjoe Access 4 March 7th, 2007 03:46 AM
Date formats... dd/mm/yyyy SeanW Classic ASP Databases 3 June 14th, 2004 12:34 PM

All times are GMT -4. The time now is 06:50 AM.

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