Raised This Month: $183 Target: $400
 45% 

[INC] Time Parser


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ratawar
Member
Join Date: Dec 2017
Location: Argentina
Old 10-08-2020 , 00:10   [INC] Time Parser
Reply With Quote #1

I created this include having in mind situations where more friendly time inputs could come handier than specifying everything in minutes when we're talking about, let's say, ban times.
Instead of the user thinking how many minutes a day, a week, 2 hours or 3 months could be, this parser would solve this issue in a very elegant and practical way.

It takes inputs in the form of 3d (3 days), 4w2h (4 weeks and 2 hours), or even 1y1y120d and will sum up to the proper 2 years and 120 days.

The function sums up all valid time inputs from the string, calculates the future date it sums up to and returns that date as a UNIX timestamp.

If any questions, criticism or feedback (which is always appreciated) let me know down below. Thanks!


Include and Test Plugin Sources on GitHub!
__________________

Last edited by ratawar; 11-24-2020 at 08:54.
ratawar is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:18.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode