hey Rohit,
on similar lines we have created a console application, just copy the code and paste it into the webpart page.
one more thing..
we hv created a managed property named CreatedOn that has values from the custom defined column.
share point on its own does not gives u a column named Created On so you have to create it by your own.
here goes the code snippet
using System;
using System.Web;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using Microsoft.Office.Server;
using Microsoft.Office.Server.Administration;
using Microsoft.Office.Server.Search;
using Microsoft.Office.Server.Search.Administration;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.Office.Server;
using Microsoft.Office.Server.Search;
using Microsoft.Office.Server.Search.Query;
using System.Xml;
using System.Data;
using System.Runtime.InteropServices;
namespace BusinessLayerTestCases
{
public class Program
{
static void Main(string[] args)
{
//The string containing the keyword to use in the search
//string sqlString = "SELECT Tech,Title FROM Scope() WHERE Tech = 'windows'";
string sqlString = "SELECT CreatedOn, Title FROM Scope() WHERE CreatedOn >= GETGMTDATE()";
using (SPSite site = new SPSite("http://moss:42007"))
{
FullTextSqlQuery query = new FullTextSqlQuery(site);
query.QueryText = sqlString;
query.ResultTypes = ResultType.RelevantResults;
ResultTableCollection coll = query.Execute();
if ((int)ResultType.RelevantResults != 0)
{
ResultTable tblResult = coll[ResultType.RelevantResults];
if (tblResult.TotalRows == 0)
{
Console.WriteLine("No Search Results Returned.");
}
else
{
Console.WriteLine("Search Results Returned From Object Model");
DataTable dtResults = new DataTable("tblResults");
DataSet dsResults = new DataSet("dsResults");
dsResults.Tables.Add(dtResults);
dsResults.Load(coll[ResultType.RelevantResults], LoadOption.OverwriteChanges, dtResults);
Console.WriteLine("Row count:" + dtResults.Rows.Count);
foreach (DataRow dr in dtResults.Rows)
{
Console.WriteLine("\n\n");
Console.WriteLine(dr.ItemArray[1]);
}
}
}
}
Console.ReadKey();
}
}
}
you may also refer http://msdn2.microsoft.com/en-us/library/ms559713.aspx for date related functions