.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

date function

Posted By: Catherine     Posted Date: August 02, 2011    Points:5   Category :VB.Net
Hi i would like to check the date that should be less than or equal to five of my session date

Author: Amit Mehra             
Posted Date: August 02, 2011     Points: 20   


If you have datetime in session object you can use the below code

  DateTime dtSession = Convert.ToDateTime(Session["Date"]);

DateTime dtNow = DateTime.Now;

if (dtNow < dtSession.AddDays(-5))
//your rest logic

Hoe this helps

Please "Mark As Answer " if this post help you.
Author: Gowthammanju             
Posted Date: August 10, 2011     Points: 20   

Hey keep look at these step as

RangeValidator is useful when you have both a start and end date to compare to one value. You want to compare a value to another single value. So use the CompareValidator, with Type=Date, Operator=LessThanEqual, ValueToCompare = DateTime.Today.ToShortDateString(). Set that ValueToCompare in Page_Load or using DataBinding.

Thanks & Regards,

Mark if the answer is true

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend