| | |
check date
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2009
Posts: 31
Reputation:
Solved Threads: 0
Hi to all,
I am developing asp.net website using VB.
In my website user registerd to access facilities but I want to give that authority for 1 month only. after 1 month user has to renew his account.
I am inserting date when he registerd in our site.
But the problem is how to find one month later date..?
let us consider one user is registerd on 12/8/2009 & I want to give message that your status will be inactive on 12/9/2009.
How to do that..?
Plz help!
I am developing asp.net website using VB.
In my website user registerd to access facilities but I want to give that authority for 1 month only. after 1 month user has to renew his account.
I am inserting date when he registerd in our site.
But the problem is how to find one month later date..?
let us consider one user is registerd on 12/8/2009 & I want to give message that your status will be inactive on 12/9/2009.
How to do that..?
Plz help!
•
•
Join Date: Sep 2007
Posts: 66
Reputation:
Solved Threads: 12
0
#2 Oct 12th, 2009
Hi There
You can try this code
Note : RegisterDate is your actual date from table
Mark as solved if it helps you!!!
You can try this code
Note : RegisterDate is your actual date from table
ASP.NET Syntax (Toggle Plain Text)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If CheckIsValidUser() = False Then Label1.Text = "Your Status is INACTIVE" Else Label1.Text = "Your Status is ACTIVE" End If End Sub Private Function CheckIsValidUser() As Boolean ' Dim RegisterDate As Date = Microsoft.VisualBasic.DateAdd(DateInterval.Month, -1, Date.Today).ToString Dim ExpiryDate As String = Microsoft.VisualBasic.DateAdd(DateInterval.Month, 1, RegisterDate).ToString If ExpiryDate.ToString = Date.Today.ToString Then ''Raise your exception Return False Else Return True End If End Function
Last edited by reach_yousuf; Oct 12th, 2009 at 3:49 am.
•
•
Join Date: Oct 2009
Posts: 3
Reputation:
Solved Threads: 0
0
#4 32 Days Ago
try this this would work-
ASP.NET Syntax (Toggle Plain Text)
DateTime validTillDate = registrationDate.AddMonths(1); if (DateTime.Compare(DateTime.Now, validTillDate) < 0) { //Active } else { //Inactive }
Last edited by peter_budo; 32 Days Ago at 10:49 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)
![]() |
Similar Threads
- How to Add date to file Name (Windows NT / 2000 / XP)
- How to check date in asp format is #dd-mm-yyyy# (ASP)
- booking check in and check out date ? (PHP)
- Check if date is valid (C++)
- check time & date bios error - it won't boot up (Troubleshooting Dead Machines)
- parsing date strings mm/dd/yy?? (C++)
- VBA Date Format (Visual Basic 4 / 5 / 6)
Other Threads in the ASP.NET Forum
- Previous Thread: chat room in asp.net
- Next Thread: Custom HttpHandler.
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox class click commonfunctions compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dropdownlist dropdownmenu dynamic edit embeddingactivexcontrol expose findcontrol flash flv formatdecimal forms formview gridview homeedition iframe iis javascript jquery list login menu microsoft mono mssql multistepregistration nameisnotdeclared numerical objects order panelmasterpagebuttoncontrols problem ratings rotatepage save schoolproject search security serializesmo.table silverlight smartcard sql sqlserver2005 ssl suse textbox tracking unauthorized validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment webservice wizard xml youareanotmemberofthedebuggerusers





