Hi all. I'm teaching myself JavaScript in order to write a simple web-app to help my wife track when her dog poops and pees. The concept is that every time the dog poops, she presses a button on the webpage that is set as an icon on her phone. Ever time it pees, she presses a seperate button. The time is then stored as a cookie, and an average time is eventually worked out. The code below is just proof of concept, but I can't seem to get it to work, and I don't have enough experience to really know what I'm doing wrong.

Code:
<html>
<head>

<p id="AVGOut"> Loading cookie </p>

<script type="text/javascript">
function GetCookie()
{

var ReadHour=getCookie(poopH);
var ReadMin=getCookie(poopM);

document.getElementById("AVGOut").innerHTML=ReadHour;
}

function SetCookie()
{

var D = new Date();
var d= D.getUTCHours();
var WriteTimeHour= d-4;

var p= D.getUTCMinutes();
var WriteTimeMinute=p;
setCookie("PoopH",WriteTimeHour,365);
setCookie("PoopM",WriteTimeMinute,366);

}
</script>
</head>

<body>

<button type ="button" onclick="GetCookie()">GetCookie</button>
<button type ="button" onclick="SetCookie()">SetCookie</button>

</body>
</html>