Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to:creating date limitation on logging?
Posted
Comments
Sergey Alexandrovich Kryukov 22-Aug-11 17:50pm    
What's the problem here? Don't know how to inquire current data and compare dates?
--SA
sajad_rafiee 23-Aug-11 5:06am    
I appreciate your answer.
this is not my problem.my problem is how to setting timing of login.for example I want a user login to website in a peroid of time.

1 solution

Assuming you know how to do authorization in general and your problem is only the timing, here is the answer: use the type System.DateTime. You can get current time using the static method System.DateTime.Now or System.DateTime.UtcNow (which is good when your application serves multiple time zones). For comparison, simply use operators "==", "!=", "<", ">", "<=" and ">=". That should be enough for all your purposes.

See http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900