Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Need some help with dates
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

AliasMoze
New Member

USA
55 Posts

Posted - 08 August 2002 :  18:48:21  Show Profile  Visit AliasMoze's Homepage
I'm working on a very simple Blog solution that pulls from a particular Snitz Category.

My problem is as follows. A common Blog function is an Archive showing the previous years and months. Now, I'm not worried about generating this list dynamically, because it needs updating maybe once a month.

But how can I filter records by year and month. I wouldn't ask if I hadn't tried everything I know, so I'll throw myself at your feet and beg for an answer.

dayve
Forum Moderator

USA
5820 Posts

Posted - 08 August 2002 :  19:14:26  Show Profile  Visit dayve's Homepage
Here is a sample date that Snitz has in the database:

20020808135111

Positions 1 through 8 is your date as follows.

1-4 is Year
5-6 is Month
7-8 is Day

you can use a MID function to extract the portions you need.




http://www.burningsoulsforum.com · Snitz Specs · Snitz Mods · Do's and Dont's
Go to Top of Page

AliasMoze
New Member

USA
55 Posts

Posted - 08 August 2002 :  19:22:45  Show Profile  Visit AliasMoze's Homepage
Dayve, thanks.
I guess what I need to know is how to write a SQL query for filtering the records. If what I just said is a bad idea, please let me know.

Alternatively, I would pull ALL the records, check their dates, and just print the ones that matched.

Which method is better.
Go to Top of Page

AliasMoze
New Member

USA
55 Posts

Posted - 08 August 2002 :  19:25:34  Show Profile  Visit AliasMoze's Homepage
Smurf me. Or is it a better idea to put together a date string, say

20010803123408,

and then compare it to the date in the field? If so, do I do this with a WHERE commmand? If so, how?

Thanks again.

Edited by - AliasMoze on 08 August 2002 19:27:09
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 08 August 2002 :  19:33:16  Show Profile  Visit dayve's Homepage
off the top of my head, Snitz does have a function to convert this, I think it is something like StrToDate(strDateTime). I don't have source code in front of me right now but it would be in the inc_functions.asp and you could use that routine to possibly do some date matching.

Are you just trying to compare Year or full date? If you need the full date it would be something like

strDate = mid(dateField,7,2) & "/" & mid(dateField,5,2) & "/" & mid(dateField,1,4)

this would give you MM/DD/YYYY

http://www.burningsoulsforum.com · Snitz Specs · Snitz Mods · Do's and Dont's
Go to Top of Page

GauravBhabu
Advanced Member

4288 Posts

Posted - 08 August 2002 :  19:36:30  Show Profile
You can retreive the records with the sql in the following Format.


strSql = "" & _
"SELECT [FIELDS] " & _
"FROM [TABLENAME] " & _
"WHERE [CATIDFIELD]=" & CATID " AND [DATEFIELD] LIKE '" & YYYY & MM & "__________' " & _
"ORDER BY Left([DATEFIELD],6);"


Note: __________ is 8 underscores (_)

<EDIT>

www.forumSquare.com - Rakesh Jain - It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying.

Edited by - GauravBhabu on 08 August 2002 19:42:21
Go to Top of Page

AliasMoze
New Member

USA
55 Posts

Posted - 08 August 2002 :  19:36:58  Show Profile  Visit AliasMoze's Homepage
I'm trying to get the topics from the database that match a particular month and year.

Hey, I just saw you there, Gaurav. I think you have it! Thank-you. I grovel at your feet. You too Dayve.

Edited by - AliasMoze on 08 August 2002 19:40:00
Go to Top of Page

AliasMoze
New Member

USA
55 Posts

Posted - 08 August 2002 :  19:56:51  Show Profile  Visit AliasMoze's Homepage
Gaurav,
Do I actually put "________" (underscores) in the SQL query?

AliasMoze
"That activates my hilarity unit."
Go to Top of Page

GauravBhabu
Advanced Member

4288 Posts

Posted - 08 August 2002 :  19:59:29  Show Profile
Yes

www.forumSquare.com - Rakesh Jain - It is difficult to IMPROVE on Perfection, There is no harm in Keep Trying.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07