walapu Posted September 7, 2009 Share Posted September 7, 2009 Hello I am wondering if someone would be willing to help me create a script, because this one is kinda complicated lol. What happens is that I specify 2 times, lets say 3:30 pm to 5:00 pm. At the beginning there will be a percent that is 0%, as time passes the percent will get higher and higher until it is at 5:00 pm. It will then be at 100%.This is for a website maintenance progress bar if you can tell.\Thanks!Also would this be better to be done in perl? Link to comment Share on other sites More sharing options...
AElliott Posted September 7, 2009 Share Posted September 7, 2009 Well, this doesn't seem too hard to do. Logical steps: Define times 1 and 2, how complicated this is depends on your requirements, possibly involving a database for ease of use Check if time 1 has arrived yet, if not handle case that time period has yet to arrive Check if we're later than time 2, if so the time period has already elapsed If neither of the previous were true then we handle the case that we are in that time period, subtract time 1 from time 2 (as unix timestamps) (result is sum 1), subtract time 1 from time() (result is sum 2), 100*(sum1-sum2) is the percentage Which bit of that are you unsure of? Perl would be better if you're familiar with perl I suppose, if you're more familiar with PHP and the app is written in it then there's no compelling advantage to mix languages. Link to comment Share on other sites More sharing options...
justsomeguy Posted September 8, 2009 Share Posted September 8, 2009 This should be written in Javascript so that it can animate, all you need from PHP is to tell Javascript what the start and end are (it should use server time instead of browser time). Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.