
Guessing that your time stamps are in the db. use MYSQL ..... IF ( CURRENT_TIMESTAMP<http://www.tutorialspoint.com/mysql/mysql-date-time-functions.htm#function_current-timestamp>() BETWEEN start_date AND end_date, 1, 0) That would return a Boolean (1 or 0) if your current_time_stamp is between the start & end dates .. 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?*
On Thu, May 2, 2013 at 11:02 AM, Bwana Lawi <mail2lawi@gmail.com> wrote:
Adding 24 to both endtime and current time when the endtime is less than starttime seems to work.
On Thu, May 2, 2013 at 10:51 AM, Francis Njenga <korefn@gmail.com> wrote:
@Adam not knowing the offending language, a concrete solution is as a pain so making sure he knows that specific fact('In the abstract') would have sufficed IMHO. [?]
On Thu, May 2, 2013 at 10:46 AM, Adam Nelson <adam@varud.com> wrote:
@francis I think he's using the word 'timestamp' loosely as the time of day. But yes, as everyone agrees so far, just use the timestamp which has all the date information and then comparison is trivial.
Since we all seem to be having fun wasting time on a Thursday, I did it in Python for demonstration purposes. I set 'a' to now and then 'b' to now a few seconds later and then arbitrarily set 'c' to a time within the period. This is date-sensitive.
---------------- ➜ ~ python Python 2.7.3 (default, Dec 5 2012, 11:30:37) [GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin Type "help", "copyright", "credits" or "license" for more information.
> import datetime > a = datetime.datetime.now() > a datetime.datetime(2013, 5, 2, 10, 42, 36, 877059) > b = datetime.datetime.now() > b datetime.datetime(2013, 5, 2, 10, 42, 50, 684714) > c = datetime.datetime(2013, 5, 2, 10, 42, 49, 000000) > c datetime.datetime(2013, 5, 2, 10, 42, 49) > bool(a <= b < c) False > bool(a <= c < b) True >
https://twitter.com/varud https://www.linkedin.com/in/adamcnelson
On Thu, May 2, 2013 at 9:37 AM, Francis Njenga <korefn@gmail.com>wrote:
A timestamp will have all these details and you can extract the relevant details from it. I.e. datetime has both date and time. You can use the time or date where relevant. This is the essence of a timestamp.
On Thu, May 2, 2013 at 10:31 AM, Peter Karunyu <pkarunyu@gmail.com>wrote:
@Lawi, does the start times change per day or are they sorta fixed at a preset time?
Say, every day at 0600Hrs is the start, and every day at 1800Hrs is the end
_______________________________________________ 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
-- Kore Francis Njenga Running and Walking are only breaths apart.
_______________________________________________ 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
-- Kore Francis Njenga Running and Walking are only breaths apart.
_______________________________________________ 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
-- Regards, Peter Karunyu -------------------
_______________________________________________ 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