Fixed Duration Weekly, Monthly and Daily Accounts
Marinko Tarlac
mangia81 at gmail.com
Fri Nov 11 23:40:55 CET 2011
For example, Mikrotik understands this syntax
id | UserName | Attribute | Value | Op
183 | someuser| Expiration | October 04 2011 00:00:00 | ==
To convert 2011-10-04 into October 04 2011 00:00:00 you should use the
next SQL syntax
SELECT DATE_FORMAT( `date` , '%M %d %Y %H:%i:%s' ) AS date FROM users
WHERE ....
Or check the next example
SELECT DATE_FORMAT('2011-10-04','%M %d %Y %H:%i:%s') AS date,
DATE_FORMAT((NOW()+ INTERVAL 1 day),'%M %d %Y %H:%i:%s') AS date2....
gives
date date2
October 04 2011 00:00:00 November 12 2011 23:52:57
(right now is November 11 2011 23:52:57)
On 11/11/2011 10:48 PM, Fajar A. Nugraha wrote:
> On Sat, Nov 12, 2011 at 2:43 AM, JennyBlunt<jennyshoehorn at me.com> wrote:
>> I'm looking at your query and am a bit lost as to what I should use for the
>> attributes.
>>
>> Say I wanted 24 hour voucher - expires exactly 24 hours after first login. I
>> need to give the user some attribute in the db of 86400 seconds - for
>> example I'll call this Access-Duration
> You can't. It's not a valid attribute.
> You use existing Expiration instead, where
>
> Expiration = now() + whatever-value-you-want-for-the-account-to-be-valid
>
> There are of course additional details, like what the format of
> Expiration attribute should be (e.g. using 2011-11-11 won't work),
> and how to do the actual addition (simply using "+" in mysql won't
> work).
>
> Hint: try http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html
> . Should be easy enough, but might take several hours of trying to get
> the correct syntax right. If you're still confused, hire an
> experienced mysql developer to help you out.
>
More information about the Freeradius-Users
mailing list