@Ken, if you are to set up a parameter for what times users are allowed to log in how would you store that parameter?


On Thu, May 2, 2013 at 1:56 PM, Ken Muturi <muturiken@gmail.com> wrote:
@Lawi ...

 To my understanding Time always have a date.. but if inyour case 0600 or 1800  i don't think that can get you a date... My Question is Why would you want to store 0600 or 1800 into the db ? you have less control of the output.. i would have preferred a unixtimestamp or a datetime..

TRY THIS

SELECT DATE_FORMAT(CURRENT_TIMESTAMP(), '%H%i') AS _hour, IF ( DATE_FORMAT(CURRENT_TIMESTAMP(), '%H%i') BETWEEN  1300 AND 1500, 1, 0)  AS _check

always replace my 1300 and 1500 to your variables................





On Thu, May 2, 2013 at 1:21 PM, Bwana Lawi <mail2lawi@gmail.com> wrote:
@Peter, sorry for the late reply


On Thu, May 2, 2013 at 11:11 AM, Peter Karunyu <pkarunyu@gmail.com> wrote:
@Lawi, for my edification; when you say "users to log in ONLY from 1800 to 0600", do you mean:

1. 1800 today to 0600 tomorrow OR
2. 0600 to 1800 any day?


For some reason this post is not in my threads. 

To answer your question, it is ANY DAY. Not tomorrow. As long as the current (server) time is not between those two times the user should not be able to log in.

@Ken,
The params in the db are for time, not date.

Anyway, if the start time is less than end time (meaning they fall on same day) I can do a direct compare. 

If end time is less than start time, meaning the interval rolls into the next day then all i did was add 24 to both end time and the current time (for comparison)

Then I did the same if

_______________________________________________
skunkworks mailing list
skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke


_______________________________________________
skunkworks mailing list
skunkworks@lists.my.co.ke
------------
List info, subscribe/unsubscribe
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------

Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke