Jump to content
  • 0

Intrebare/problema zile vehicule


cocaina

Question

Nu o mai lungesc, va spun pe scurt exact care e problema.

Mie zilele de la vehicule mi se salveaza in baza de date utilizand functia gettime(), si se salveaza in felul urmator: 1412561 (ex).

Zilele pe server se "citesc" utilizand functia GetDaysFromTimestamp.

 

Si acum intrebarea. Cum fac sa mi se afiseze zilele corect pe panel? De vreme ce ele se salveaza in forma "141451", tot asa apare si pe panel.

functia GetDaysFromTimestamp:

function GetDaysFromTimestamp( time ) {
	new timee = gettime( ) - time, days;
	while( timee > 86399 ) {
		timee -= 86400;
		days ++;
	} return days; }

Mentionez ca nu am foarte mari cunostinte php, deci.. daca se poate, o explicatie ca la "prosti" 😂

Edited by shane
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
On 1/7/2020 at 3:34 PM, shane said:

Nu o mai lungesc, va spun pe scurt exact care e problema.

Mie zilele de la vehicule mi se salveaza in baza de date utilizand functia gettime(), si se salveaza in felul urmator: 1412561 (ex).

Zilele pe server se "citesc" utilizand functia GetDaysFromTimestamp.

 

Si acum intrebarea. Cum fac sa mi se afiseze zilele corect pe panel? De vreme ce ele se salveaza in forma "141451", tot asa apare si pe panel.

functia GetDaysFromTimestamp:


function GetDaysFromTimestamp( time ) {
	new timee = gettime( ) - time, days;
	while( timee > 86399 ) {
		timee -= 86400;
		days ++;
	} return days; }

Mentionez ca nu am foarte mari cunostinte php, deci.. daca se poate, o explicatie ca la "prosti" 😂

salut, foloseste urmatorul cod:

<?php 
               $then = gmdate("Y-m-d", $car->BuyTime);		

               $then = strtotime($then);

               $now = time();

               $difference = $now - $then;

               $days = floor($difference / (60*60*24) );

               echo $days;
?>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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. For more details you can also review our Terms of Use and Privacy Policy.