Raised This Month: $51 Target: $400
 12% 

[INC] Time Parser


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ratawar
BANNED
Join Date: Dec 2017
Location: GB
Old 10-07-2020 , 23: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 07:54.
ratawar is offline
Send a message via ICQ to ratawar Send a message via AIM to ratawar Send a message via Yahoo to ratawar Send a message via Skype™ to ratawar
 



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 04:17.


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