vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to Subtract Time from Time to = Time? (https://vborg.vbsupport.ru/showthread.php?t=76874)

TheMayhem 02-23-2005 01:00 AM

How to Subtract Time from Time to = Time?
 
Basically what I'm asking if I have something like
$user['dateregistered']
$currentdate

Both of those are stored in the db, how can I take the dateregistered and subtract the current date and then be able to output a new variable called something like $totaldaysregistered. And have that totaldaysegistered display the number of days, hours, and minutes total. Is there any kind of php coding we can do to get this?

Jolten 02-23-2005 02:12 PM

PHP Code:

$totaldaysregistered$currentdate $user['dateregistered']; 

Then using $totaldaysregistered will give you the difference between the dates.

Xenon 02-23-2005 03:09 PM

as you can find in member.php that way:

PHP Code:

$jointime = (TIMENOW $userinfo['joindate']) / 86400// Days Joined 


TheMayhem 02-26-2005 03:27 AM

Quote:

Originally Posted by Xenon
as you can find in member.php that way:

PHP Code:

$jointime = (TIMENOW $userinfo['joindate']) / 86400// Days Joined 


Just wondering but what exactly would the equation to then take your Days Joined total and take that remainder to output the hours as well so like 6 Days, 2 Hours, ect.?

Xenon 03-01-2005 02:08 PM

theoretically it should be possible to use vbdate here, so in a way like:

PHP Code:

$totallyhere TIMENOW $userinfo['joindate'];
$datestring 'You are here since' vbdate('d'$totallyhere) . ' Days' ...... 



All times are GMT. The time now is 04:42 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01009 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete