开发者

jQuery time to php

I have a this value 112639618, which is the timeleft for a countdown with jQuery, how can I pass that value to something like 06/27/2011 12:33 PM using PHP

Thanks in advance

* Update *

jQuery used to output the timeleft

index_bundle.js

    var timerCurrentParticipants;var timerTimeLeft;var currentTimeLeft;var secondsForTimer;var secondsForCurrentParticipants;var url_prefix_var;var noEmailText;var subscribeSuccessText;var generalErrorText;var wrongEmailPatternText;var soldText;var participantsText;var dealTakePlaceText;var dealTookPlaceText;var requiredText;var buyerText;var sold2Text;var successfulText;var soldOutText;var requiredOneText;var NewsletterDotd={lastPropertyGroup:"",subscribe:function(url_prefix,value){var url=url_prefix+"/Newsletter.action?subscribeNewsletter=";var v=$('#emailaddress2').val();if(v==''){sendErrorMessage(noEmailText);return false;}
if(/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)){$.ajax({type:"POST",url:url,data:({email:$('#emailaddress2').val()}),dataType:"json",success:function(data){if(!data.success){sendErrorMessage(data.message);}else{window.location.href=window.location.href+"?newsletter=subscribe";}},error:function(){sendErrorMessage(generalErrorText);}});}else{sendErrorMessage(wrongEmailPatternText);}}};var Index={start:开发者_StackOverflow社区function(url_prefix,noEmail,subscribeSuccess,generalError,wrongEmailPattern,sold,participants,dealTakePlace,dealTookPlace,required,buyer,sold2,successful,soldOut,requiredOne){noEmailText=noEmail;subscribeSuccessText=subscribeSuccess;generalErrorText=generalError;wrongEmailPatternText=wrongEmailPattern;soldText=sold;participantsText=participants;dealTakePlaceText=dealTakePlace;dealTookPlaceText=dealTookPlace;requiredText=required;buyerText=buyer;sold2Text=sold2;successfulText=successful;soldOutText=soldOut;requiredOneText=requiredOne;url_prefix_var=url_prefix;currentTimeLeft=$('#currentTimeLeft').val();secondsForTimer=1000;secondsForCurrentParticipants=300000;Index.setInitialTimer();timerCurrentParticipants=setInterval(function(){Index.getCurrentParticipants(url_prefix,false);},secondsForCurrentParticipants);timerTimeLeft=setInterval(function(){Index.setTimer();},secondsForTimer);},getCurrentParticipants:function(url_prefix,finished){var url=url_prefix+"/DealOfTheDay.action?getCurrentParticipants=";$.ajax({url:url,data:({dotdId:$('#dotdId').val(),alreadyFinished:finished}),dataType:"json",success:function(data){if(!data.success){}else{var replacedText=sold2Text.replace(/\{0\}/,data.currentParticipants);$('#contentDealStatusBox .soldAmount').empty().append(replacedText);if(Number(data.currentParticipants)>0){$('#contentDealStatusBox .soldAmount').show();}
var currentPercent=Number(data.currentParticipantsPercent);var displayPercent=Math.round(currentPercent*1.84);$('.progressBarMarker').css('width',(displayPercent+16)+'px');$('.progressBarSliderMid').css('width',(displayPercent)+'px');if(data.minReached){if($('#contentDealStatusBox .progressBarNumbers').html()!='<br/>'){$('#contentDealStatusBox .progressBarNumbers').html('<br/>');$('.progressBar').delay(800).hide('slow');$('#dealTakePlace').show();}}else{if(data.participantsLeft==1){$('#contentDealStatusBox .progressBarNumbersText').html(requiredOneText);}
else{$('#req_part').text(data.participantsLeft);}}
if(data.finished){$('#dealTakePlace').hide();if(data.minReached){$('#contentDealStatusBox .dealRunning').empty().append("<span>"+successfulText+"</span>");}else{$('#contentDealStatusBox .dealRunning').empty().append("<span>"+soldOutText+"</span>");}
clearInterval(timerCurrentParticipants);$('#contentDealStatusBox .dealRunning').hide();$('#contentDealStatusBox .dealSuccessful #dealTookPlace').show();}}},error:function(){}});},setTimer:function(){currentTimeLeft=parseInt(currentTimeLeft-secondsForTimer);if(currentTimeLeft<=0){$('#hoursLeft').empty().append("00");$('#minutesLeft').empty().append("00");$('#secondsLeft').empty().append("00");$('#timerBlock').hide();Index.getCurrentParticipants(url_prefix_var,true);clearInterval(timerTimeLeft);}else{var wholeSeconds=parseInt(currentTimeLeft/1000);var wholeMinutes=parseInt(currentTimeLeft/60000);var wholeHours=parseInt(wholeMinutes/60);var seconds=parseInt(wholeSeconds%60);var minutes=parseInt(wholeMinutes%60);var days=parseInt(wholeHours/24);var hours=parseInt(wholeHours%24);if(wholeHours<10){$('#hoursLeft').empty().append("0"+wholeHours);}else{$('#hoursLeft').empty().append(wholeHours);}
if(minutes<10){$('#minutesLeft').empty().append("0"+minutes);}else{$('#minutesLeft').empty().append(minutes);}
if(seconds<10){$('#secondsLeft').empty().append("0"+seconds);}else{$('#secondsLeft').empty().append(seconds);}}},setInitialTimer:function(){if(currentTimeLeft<=0){$('#timerBlock').hide();Index.getCurrentParticipants(url_prefix_var,true);clearInterval(timerTimeLeft);}else{var wholeSeconds=parseInt(currentTimeLeft/1000);var wholeMinutes=parseInt(currentTimeLeft/60000);var wholeHours=parseInt(wholeMinutes/60);var seconds=parseInt(wholeSeconds%60);var minutes=parseInt(wholeMinutes%60);var days=parseInt(wholeHours/24);var hours=parseInt(wholeHours%24);if(wholeHours<10){$('#hoursLeft').empty().append("0"+wholeHours);}else{$('#hoursLeft').empty().append(wholeHours);}
if(minutes<10){$('#minutesLeft').empty().append("0"+minutes);}else{$('#minutesLeft').empty().append(minutes);}
if(seconds<10){$('#secondsLeft').empty().append("0"+seconds);}else{$('#secondsLeft').empty().append(seconds);}}}};function toggleAcceptNewsletterOptin(){var checked=$('#jAcceptNewsletterOptin').val();$('#jAcceptNewsletterOptin').val((checked=="true"?"false":"true"));}

On the page I get a input like this: <input type="hidden" id="currentTimeLeft" value="153601525"/>


A short google would give you the same result. Make use of the php time function. In your case it would be something like this:

<?php
echo date('m/d/o/g/i', 112639618);
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜