Hey all,
I'm playing around with some code, and basically the idea is:
Person changes their profileI fetch some XML that has a unix timestamp for the time the person changed their profile, so it'll keep increasing everytime I fetch the XML. It looks like this: <profileTime>12086</profileTime>I then run it through a function to convert the unix time to hours:mins:secsFinally I run it through another function to calc how long in the past that was, so it can be displayed in a user friendly format.
The issue is, every time I run it through the second function, the final displayed time keeps increasing, rather than staying the same, which it should stay the same, because the person only changed their profile once, at that original time.
Here is the first function, where I convert the unix time to h:m:s:
Code: function convert($sec, $padHours = false) {
$hms = null;
$hours = intval(intval($sec) / 3600);
$hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT). ':' : $hours. ':';
$minutes = intval(($sec / 60) % 60);
$hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ':';
$seconds = intval($sec % 60);
$hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
return $hms;
}
And here's the code in teh second function to format it:
Code: function olddate($hours, $minutes, $seconds) {
/* List of working timezones here:
*
* http://www.php.net/manual/en/timezones.php
*/
date_default_timezone_set('America/Chicago');
// Calculate the exact day and time the status message was set
$pf_time = strtotime("-".$hours." hours ".$minutes." minutes ".$seconds." seconds");
echo date("D F j, Y, g:i (s) a", $pf_time);
//return date("D F j, Y, g:i (s) a", $pf_time);
}
Anyone able to offer any advice?
Solution to the FindControl problem
I have seen may posts about having problems with the FindControl method. Most seem to come about because the control being searched for is nested within a container other than the webform.I came
Can't shake the "Warning: include()" error
I've just uploaded my site to a new server and where I have PHP include tags in my HTML, the browser reads:"Warning: include() [function.include]: SAFE MODE Restriction in effect. The script
Find only certain URLs from page ... regex (semi-complete script)
Hi guys,What I need to do is take a page & extract all the URLs from the page & place them in an array.However I only need to grab certain
Preg_match unknown modifyer
Hello,Im trying to write a little script for my forums i need to get the reply from my forums. Im trying thisCode: $pattern = '/<span
Just cannot get 'area' to submit to db using same php code as already used
Basically all i have done is just modified some code and added an area section.The form is allready submitting other things like location price etc.And i have simply added a field in db called area
How to load mysql (and other) extensions into PHP
How to load mysql (and other) extensions into PHP PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken
This is driving me nuts!
This insert query looks to be alright, however I get this error:QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
Calander layout
Hi i know this sounds like a simple question but i cant find the answer to it anywhere i have added a simple calander tool to the page and added some styles to it but i want to move the month name
url- go to webpage
i have an input text field and submit button.how do i make the url entered into the textfield go to that webpage?
PHP submit form script causing blank page
Im trying to submit a form using this script, however nothing shows up on the page, does anyone know why it's not working?ThanksCode: <?php // Connects to your Database