特定时间后隐藏按钮

I want to hide a button after a user submits a form. I stored the time the user submitted the form in a database table already. What I want is to disable the button 2 seconds after the user clicks on it.

I am using php to calculate the time difference and javascript to hide the code.

I am not sure if this is correct, but the php code will add 2 seconds to the time the user submits the form and subtract if from the current time.

Here is my code

$a = $row_rsGH['time'];
$b = round(microtime(true));
$c = '2000';//--code in milliseconds
$d = ($a+$c)-$b;

<script type="text/javascript">  
setTimeout(function() {
    $('#ghdiv').fadeOut('fast');
}, <?php echo $d; ?>); // <-- time in milliseconds
</script>

My aim is that I want the submit button to be hidden, 2 seconds after it is clicked and when i refresh, it won't show

try this code:

when you click button after 2 seconds the button hide if its id=ghdiv

    document.getElementById("ghdiv").addEventListener("click",function(){
//you can put here any code to procced after the button clicked
        setInterval(function(){
        $('#ghdiv').fadeOut('fast');
        },20000);
});

You don't need that amount of complexity. Do it all using js:

document.getElementById("ghdiv").addEventListener("click",function(){
        setTimeout(function(){
        $('#ghdiv').fadeOut('fast');
    },2000);
});
button{
    color: white;
    background-color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="ghdiv">My Button</button>

</div>