Jump to content

ramli

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Everything posted by ramli

  1. I created a function to show me a date after i did some calculations with it. it works to show singel varables for exaple: $date1 = "2007-06-16"; $date2 = "2007-06-18"; $date1 = strtotime($date1); $date2 = strtotime($date2); $calc = $date2 - $date1; $dateview = TCONV($calc); echo($dateview['day']); This returns 2 days differance however when i want to calculate with a date i get strange readings $date1 = "2007-06-16"; $date1 = strtotime($date1); $date1 = $date1 + 86400; // for 1 day $dateview = TCONV($date1); echo($dateview['day'].$dateview['month'].$dateview['year']); in this case it returns 13680.91666666775771.2307692316314.2692307692 with i dont understand wy. It should have to return 2007-06-17. function is below //--------------------------TCONV----------------------------// //Get date from seconds function TCONV($dateinsecs) { if($dateinsecs >= 187200) { $dateinsecs = floor($dateinsecs); $year = ($dateinsecs / 187200); } if($dateinsecs >= 15600) { $dateinsecs = floor($dateinsecs); $month = ($dateinsecs / 15600); } if($dateinsecs >= 86400) { $dateinsecs = floor($dateinsecs); $day = ($dateinsecs / 86400); } if($dateinsecs >= 3600) { $dateinsecs = floor($dateinsecs); $hour = ($dateinsecs / 3600); } if($dateinsecs >= 60) { $dateinsecs = floor($dateinsecs); $minute = ($dateinsecs / 60); } if($dateinsecs >= 0) { $seconds = floor($dateinsecs); } if(isset($year)){$time_int['year'] = $year;} if(isset($month)){$time_int['month'] = $month;} if(isset($day)){$time_int['day'] = $day;} if(isset($hour)){$time_int['hour'] = $hour;} if(isset($minute)){$time_int['minute'] = $minute;} if(isset($seconds)){$time_int['seconds'] = $seconds;} return $time_int; } I have had some problems with this bevore can somone please help me with this ?
  2. Created a function that works //--------------------------TCALC----------------------------// //Get date from seconds function TCALC($dateinsecs) { if($dateinsecs >= 187200) { $dateinsecs = floor($dateinsecs); $year = ($dateinsecs / 187200); } if($dateinsecs >= 15600) { $dateinsecs = floor($dateinsecs); $month = ($dateinsecs / 15600); } if($dateinsecs >= 86400) { $dateinsecs = floor($dateinsecs); $day = ($dateinsecs / 86400); } if($dateinsecs >= 3600) { $dateinsecs = floor($dateinsecs); $hour = ($dateinsecs / 3600); } if($dateinsecs >= 60) { $dateinsecs = floor($dateinsecs); $minute = ($dateinsecs / 60); } if($dateinsecs >= 0) { $seconds = floor($dateinsecs); } $time_int = array('year'=>$year,'month'=>$month,'day'=>$day,'hour'=>$hour,'minute'=>$minute,'seconds'=>$seconds); return $time_int; } $date1 = "2007-06-16"; $date2 = "2007-06-18"; $date1 = strtotime($date1); $date2 = strtotime($date2); $date = $date2 - $date1; $dateview = TCALC($date); echo($dateview['day']); You know you will be returnd a day becouse you Deduct the dates from eachother it will return 2 (days)
  3. if used this method $date1 = "2007-06-16"; $date2 = "2007-06-18"; $covertdate1 = strtotime($date1); $covertdate2 = strtotime($date2); $differance = $covertdate2 - $covertdate1; $result = date("d-m-Y", $differance); echo($result); It outputs 03-01-1970 i want it to output 2 as if the difference is 2 day's what am i doing wrong ?
  4. Hi im working on a invoice system. In this system i have to calculate with time and dates.Im searching to find a custom or php function that allows me to do this. it has t work somthing like this. Adding Time 2007-06-14 + 2 days = 2007-06-16 2007-06-31 + 2 days = 2007-07-02 2007-06-11 + 1 month = 2007-07-11 2007-06-11 + 1 year = 2008-06-11 ect.. Telling Difference 2007-06-14 ~ 2007-06-16 = 2 Days ect.. Deducting Time (-) Same story for Time (00:00:00) I cant seem to find a topic or function that does all this... Perhaps im looking in the wrong places if u can help me please do so. thanks in Advance.
  5. Thax for responding the problem is solved i have alredy asked the moderator to remove the topic
  6. Hello, I want to send data using the mailfunction of php. this is de data and code <table width='100%' cellpadding='0' cellspacing='0'> <tr> <td> #InvoiceIncomeName# <BR /> #IncomeAdress# <BR /> #IncomeZipcode# #IncomeLocation#<BR /> <BR /> </td> <td width='200' align='right'><table cellpadding='0' cellspacing='0'> <tr> <td> #CompanyName# #CompanyType#<BR /> #CompanyAdress# <BR /> #CompanyZipcode# #CompanyLocation#<BR /> <BR /> </td> </tr> </table></td> </tr> </table> <BR /> <BR /> <table width='100%' cellpadding='0' cellspacing='0'> <tr> <td> #LangInvoiceDate#: #InvoiceDate# </td> <td align='center'> #LangIncomeID#: #IncomeID# </td> <td align='right'> #LangID#: #InvoiceID# </td> </tr> </table> <BR /> <BR /> <table width='100%' cellpadding='0' cellspacing='0'> <tr> <td>#RuleRule#</td> <td>#RuleName#</td> <td>#RuleDescription#</td> <td>#RuleCostUnit#</td> <td>#RuleNumbers#</td> <td>#RuleTotal#</td> </tr> <!-- Start Border --> <tr> <td style='border-top: 1px black solid;'> </td> <td style='border-top: 1px black solid;'> </td> <td style='border-top: 1px black solid;'> </td> <td style='border-top: 1px black solid;'> </td> <td style='border-top: 1px black solid;'> </td> <td style='border-top: 1px black solid;'> </td> </tr> <!-- End Border --> <tr height='10'> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <!-- Spacer --> #Rules# <tr height='10'> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <!-- Spacer --> <!-- Start Border --> <tr> <td style='border-top: 1px black solid;'> </td> <td style='border-top: 1px black solid;'> </td> <td style='border-top: 1px black solid;'> </td> <td style='border-top: 1px black solid;'> </td> <td style='border-top: 1px black solid;'> </td> <td style='border-top: 1px black solid;'> </td> </tr> <!-- End Border --> <tr height='10'> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <!-- Spacer --> <tr> <td></td> <td></td> <td></td> <td></td> <td>#LangTax#</td> <td>#TotalTax#</td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> <td>#LangSubtotal#</td> <td>#TotalSum#</td> </tr> <tr> <td></td> <td></td> <td></td> <td></td> <td style='border-top: 1px black solid;' >#LangTotal#</td> <td style='border-top: 1px black solid;'>#TotalTotal#</td> </tr> </table> <BR /> <BR /> The processor $view = "MIME-Version: 1.0\r\n"; $view .= "Content-type: text/html; charset=iso-8859-1\r\n"; $view .= "From: $frommail"; $message = "$text"; echo($text); mail($email, $subject, $message, $view); For some reson it edits my data to create small error like removing a tag from a td or removing the p from px in the style. I cant think of a logical reson wy this is happening maby u can help me. Any help is welcom. Thax in advance.
  7. Oke i want to create draw data from a div into a input box using the following scripts: This code hides and unhides a div Code: var state = 'none'; function showhide(layer_ref) { if (state == 'block') { state = 'none'; } else { state = 'block'; } if (document.all) { //IS IE 4 or 5 (or 6 beta) eval( "document.all." + layer_ref + ".style.display = state"); } if (document.layers) { //IS NETSCAPE 4 or below document.layers[layer_ref].display = state; } if (document.getElementById &&!document.all) { hza = document.getElementById(layer_ref); hza.style.display = state; } } And here is the code i use on a onclick action: Code: function setValue(val) { document.invoiceadd.incomeid.value = val; showhide('div1'); return false; } When if opend the div here is the action i take Code: onclick="return setValue('1');'" My form name is invoiceadd and the inputname is incomeid. the idea is that i set the value of incomeid in this case to 1. And exit the div frame. But i will not do neitherone so if someone could help me it well be mutch appriciated
  8. that is correct it is for formatting a invoice id thx for the help
  9. check http://www.phpfreaks.com/tutorials/114/0.php for the excel
  10. first english is not my mother language. second my question is how do i convert a 0 to D000000.
  11. Hellow, I want to format my id's in a sertan way however i am not sure how t approatch this problem. i want to write a function that formats a 0 to D000000. However i alsow wat to be eable to convert them back from D000000 to 0 to make calculations with it. For exaple adding 1 to create D100000. Any help would be mutch appreciated.
  12. I want to create a link (<a>) that enables me to send the value of select box with name "test" to a popup window using the header. for exaple: select box has the value "here". When i click on the link a window opens using "pop-up.html?test=here". I cant seem to find a tuturial or topic that describes my problem. I any of u can help me it will be mutch aprisiated.
  13. I have four tables. ## Income #################### #User ID |Number |UniqeID |date # #1 |300 |2 | 1-2-2006 # #1 | |3 | 1-3-2006 # ############################ // if number is empty ## Income items################# #User ID |Number |UniqeID |date # #1 |400 |3 | 1-3-2006 # #1 |244 |3 | 1-3-2006 # ############################ ////////////////////////////////////////////// ## Outcome ################### #User ID |Number |UniqeID |date # #1 |400 |2 | 1-2-2006 # #1 | |4 | 1-3-2006 # ############################ // if number is empty ## Outcome items ############### #User ID |Number |UniqeID |date # #1 |400 |4 | 1-3-2006 # #1 |200 |4 | 1-3-2006 # ############################ Desierd outcome: # Type # Number # UserID # date # # Outcome | 600 | 1 | 1-3-2006 # # Income | 644 | 1 | 1-3-2006 # # Outcome | 400 | 1 | 1-2-2006 # # Income | 300 | 1 | 1-2-2006 # ############################## Explaination: Select in "outcome" and "income" the data and sort by "date" and display it. Next if in "income" there is no "number" present search in the table 'income items" for the same "uniqeID" and add them up to eachother and display it. I have search several forums for the aswer i hope one of you can help me with this problem. thanks in advance.
  14. i know i was just joking no harm done
  15. Thanks for all the help (and yeh don't hi jack my post )
  16. It returns "Hello quote] how are you \quote] sorry" i guess this is not your intention is the pattern correct ? i dont realy know but thats the only thing i can think of ... (removed [)
  17. I want to replace the text between the quote]/quote] including the [] itself to [...] So : fdhskfsjkfhdsjkfhdskjlfhdskjfhldskjfhj quote] hier een heel verhaal, altijd ierst anders aoiufhv;awoghaer;ogihja;goiherw /quote] jasdhklasdkjh Should be: fdhskfsjkfhdsjkfhdskjlfhdskjfhldskjfhj [...] jasdhklasdkjh Can anybody assist me with this problem ? thanks in advance
  18. Dont bother your comment made me realise my mistake. Many Thanx for your help.
  19. I am traying to calculate time. i have the following script. while ... loop { $diftot = strtotime($dif); $subtotal = $subtotal + $diftot; } function timecalc($var1,$var2,$method) { $varmktime = $var1; $varmktime = time_int($varmktime); $varmktime = ($varmktime['uur'].":".$varmktime['minuut'].":".$varmktime['seconde']); // 0:0:0 convert to 00:00:00 $tijdstukken = explode(":", $varmktime); $varmktime = date("H:i:s", mktime($tijdstukken[0], $tijdstukken[1], $tijdstukken[2])); $var['mktime'] = $varmktime; return $var; } $subtotal = timecalc($subtotal,'0','mktime'); echo($subtotal['mktime']); I have created a while loop where all enterys are added to eatchother. i inputted: diferrence 1: 00:00:07 is 1174777207 difference 2: 00:00:03 is 1174777203 Total is : 2349554410 milliseconds But when i try to calculate the total it outputs 22:00:10 insted of 00:00:10. Can anybody help me with this problem please. Thx in advance....
  20. i need to write a program that can calculate a bar diagram by using stored information in a array. So we have one textfield where the values are inputted, a butten that will insert the value into the array and finaly a calculate button that transforms all the array values int a bar diagram. can anybody help me with this ? thx in advance
  21. I want to unhide a div depending on the value of a selectbox option value <script type="text/javascript" language="JavaScript" src="subform.js"></script> <form name='template'> <select name='choise' onchange="javascript:ShowContent('value of option')"> <option value="uniquename">uniquename</option> </select> </form> ----------- This is the way it does work only this is a link. <a onmouseover="ShowContent('uniquename'); return true;" href="javascript:ShowContent('uniquename')"> [show] </a> ---------------- <div id="uniquename" style="display:none; left:200px; top:100px; border-style: solid; background-color: white; padding: 5px;"> Content goes here. </div> code in subform.js: function HideContent(d) { if(d.length < 1) { return; } document.getElementById(d).style.display = "none"; } function ShowContent(d) { if(d.length < 1) { return; } document.getElementById(d).style.display = "block"; } function ReverseContentDisplay(d) { if(d.length < 1) { return; } if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; } else { document.getElementById(d).style.display = "none"; } } as you can see i got some of the work done . However i dont know how to read the value in the onchance handeler. can sombody help me pleace.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.