The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Age count
Author Message
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #15
RE: Age count
sphere already store the account first/last connection date (<ACCOUNT.FIRSTCONNECTDATE> and <ACCOUNT.LASTCONNECTDATE>), so you must compare these 2 dates and convert it to an "readable" value, which probably the best format will be "X days"

eg: to compare dates 2016/05/10 and 2016/08/10, you must convert both dates into days using the formula: (year * 365) + (month * 30) + days

2016/05/10 = (2016 * 365) + (05 * 30) + 10 = 736000
2016/08/10 = (2016 * 365) + (08 * 30) + 10 = 736090

736090 - 736000 = 90, so the interval between these dates is 90 days

on sphere scripting it will be something like this:
Code:
[FUNCTION GetAccountAge]
return <eval <ConvertToDays <ACCOUNT.LASTCONNECTDATE>> - <ConvertToDays <ACCOUNT.FIRSTCONNECTDATE>>>

[FUNCTION ConvertDateToDays]
ARGS=<EXPLODE : /, <ARGS>>  // this will explode the date "yyyy/mm/dd HH:mm:ss" into "yyyy,mm,dd,HH,mm,ss", making it easy to get values using ARGV[0], ARGV[1], ...
return <eval (<ARGV[0]>*365)+(<ARGV[1]>*30)+<ARGV[2]>>
so with this code you will be able to get the account age using something like "SYSMESSAGE Your account age is: <GetAccountAge> days"
11-18-2016 02:53 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
Age count - Leonidas - 11-10-2016, 07:34 AM
RE: Age count - Kanibal - 11-10-2016, 07:45 AM
RE: Age count - Leonidas - 11-10-2016, 08:15 AM
RE: Age count - Kanibal - 11-10-2016, 08:23 AM
RE: Age count - Leonidas - 11-10-2016, 08:29 AM
RE: Age count - Kanibal - 11-10-2016, 08:48 AM
RE: Age count - Leonidas - 11-10-2016, 09:05 AM
RE: Age count - Kanibal - 11-10-2016, 09:12 AM
RE: Age count - Leonidas - 11-10-2016, 03:39 PM
RE: Age count - Kanibal - 11-10-2016, 08:59 PM
RE: Age count - Leonidas - 11-11-2016, 12:10 PM
RE: Age count - Ben - 11-14-2016, 06:22 AM
RE: Age count - Leonidas - 11-14-2016, 08:33 AM
RE: Age count - Ben - 11-14-2016, 08:58 AM
RE: Age count - Coruja - 11-18-2016 02:53 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)