| The Arcive of vBulletin Modifications Site. | |
| 
			 
			#1  
			
			
			
			
			
		 | |||
| 
 | |||
|  Mysql question, selecting threads by date.. 
			
			I'm creating a sort of archive and need to select threads by their created date, so I'm trying to use dateline. I know you can use vbdate() to turn it into a normal, usable date but I don't think this is any use because I can only select the raw dateline from the database, right? Of course it's possible to match the date after quering but then I would need to query way too many threads... Does anybody have a solution for this, so you can already select the right threads with a query? Or just an explanation of how the dateline is determined?? | 
| 
			 
			#2  
			
			
			
			
			
		 | |||
| 
 | |||
|   
			
			dateline is epoch time:  http://en.wikipedia.org/wiki/Unix_epoch I think what you want to do is something like : SELECT * from vb_thread where dateline <= UNIX_TIMESTAMP('2007-01-01 00:00:00'); This should select all threads created before 2007. UNIX_TIMESTAMP will convert a date to epoch time, which is the format dateline is in. Also just for the sake of completeness, FROM_UNIXTIME(dateline) will go the other way. SELECT dateline, FROM_UNIXTIME(dateline) from vb_thread; will return dateline in epoch and normal yyyymmdd h:i:s format. | 
| 
			 
			#3  
			
			
			
			
			
		 | |||
| 
 | |||
|   
			
			Thanks a lot, I had already figured it out in the mean time in a slightly different way, using mktime() to convert a $month and $year variable into 2 timestamps and then selecting all the threads with a timestamp between those 2 values to select all the threads from one month.  Again, thanks for your quick reply.    | 
| 
			 
			#4  
			
			
			
			
			
		 | ||||
| 
 | ||||
|   
			
			use vbmktime()
		 | 
|  | 
| 
 | 
 | 
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
| 
 | |
|  More Information | |
| Template Usage: 
 Phrase Groups Available: 
 | Included Files: 
 Hooks Called: 
 |