atikons Posted November 13, 2005 Report Share Posted November 13, 2005 datubāzē ( $row['e_date']) laiks tiek saglabāts šādi: 2005-12-07 man vajag uzzināt, cik dienas no šodiensa ir palikušas līdzšim datumam, nekādigi netieku galā. it kā vajadzētu būt šādi: $now = date("Y-m-d"); $dienas = $row['e_date'] - $now; echo $dienas; bet nestrādā, izvada šo "0 0" Link to comment Share on other sites More sharing options...
Klez Posted November 13, 2005 Report Share Posted November 13, 2005 nospied šeit un ruupiigi izlasi! Link to comment Share on other sites More sharing options...
Vebers Posted November 13, 2005 Report Share Posted November 13, 2005 http://lv.php.net/manual/en/function.mktime.php Link to comment Share on other sites More sharing options...
john.brown Posted November 13, 2005 Report Share Posted November 13, 2005 Un kā tu gribi atņemt divas rindas vienu no otras? Imho, jāpārveido sekundēs, un tad jāatņem. Skaties mktime() funkciju. Link to comment Share on other sites More sharing options...
atikons Posted November 13, 2005 Author Report Share Posted November 13, 2005 Pagaidām nekādu rezultātu. Link to comment Share on other sites More sharing options...
Vebers Posted November 13, 2005 Report Share Posted November 13, 2005 kaa nekaadu rezultaatu ? paskatiijies funkciju mktime ?!? tad arii laiku saliidzini unixtimestamp'aa Link to comment Share on other sites More sharing options...
atikons Posted November 13, 2005 Author Report Share Posted November 13, 2005 Nu to es sapratu, bet raksut un pagaidām nekā. Link to comment Share on other sites More sharing options...
Vebers Posted November 13, 2005 Report Share Posted November 13, 2005 Paraadi mums ko Tu raksti un tad pateiksim kur Tev kljuudas, jo shaubos vai sheit ir kaads gaishregjis .. Link to comment Share on other sites More sharing options...
atikons Posted November 13, 2005 Author Report Share Posted November 13, 2005 (edited) Šis ir: $day=16; $month=11; $year=2005; $now=mktime(); echo $now."<br>"; $time=mktime(0,0,0,$month,$day,$year); echo $timebirth."<br>"; $agetime=$time-$now; $agetime = $agetime/60/60/24; $agetime = intval($agetime); echo $agetime; Edited November 13, 2005 by atikons Link to comment Share on other sites More sharing options...
Vebers Posted November 13, 2005 Report Share Posted November 13, 2005 Tad skaties cik katrā menesī dienas un skaiti.. Link to comment Share on other sites More sharing options...
atikons Posted November 13, 2005 Author Report Share Posted November 13, 2005 Tikai kā no $row['date'] var izvilkt trīs mainīgos $day, $month, $year? Link to comment Share on other sites More sharing options...
john.brown Posted November 13, 2005 Report Share Posted November 13, 2005 A explode() priekš kā ir? Link to comment Share on other sites More sharing options...
Vebers Posted November 13, 2005 Report Share Posted November 13, 2005 $n = explode("-", $row['date']); $year = $n[0]; $month = $n[1]; $day = $n[2] Link to comment Share on other sites More sharing options...
atikons Posted November 13, 2005 Author Report Share Posted November 13, 2005 Paldies! Pie tam vēl iemācījos, kam tad īsti tas explode ir domāts. Paldies! Link to comment Share on other sites More sharing options...
Klez Posted November 13, 2005 Report Share Posted November 13, 2005 (edited) manupraat straadaa pareizi ... <? //gadaa ir 365 ja vien februaaris nau iisais meenesis $gadaa = 365 - 28; //cik dienas ir gadaa. atnjemam standarta februaari $dienas_pagajushas = date("z",mktime(0, 0, 0, date("m"), date("d"), date("Y"))); // dabuujam cik ir jau dienas pagaajushas $feb = cal_days_in_month(CAL_GREGORIAN, 2, date("Y")); //cik dienas ir tekoshaa gada februaarii $gadaa = $gadaa + $feb; echo $dienas_palikushas = $gadaa - $dienas_pagajushas; ?> http://imo.popular.lv/testi/1.php Edited November 13, 2005 by Klez Link to comment Share on other sites More sharing options...
Recommended Posts