vendredi 18 août 2017

Determine if date/time is string Javascript

I'm trying to write a code which detects if the current date is an String. Here's my code:

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
background-color: black;
text-align: center;
padding: 15px;
}
h1, h2, h3, h4, h5, h6, p, a {
text-align: center;
color: white;
font-family: "Arial", Arial
}
a {
text-decoration: none
}
</style>
<!-- JAVASCRIPT -->
<script type="text/js">

var currentDate = new Date(),
    day = currentDate.getDate(),
    month = currentDate.getMonth() + 1,
    year = currentDate.getFullYear();
    date1 = (day + "/" + month + "/" + year)
 document.write(date1)

if (date1 = "15/3/1993) {
    alert("yes")
}

</script>

<title>PRW</title>
<meta charset="UTF-8">
</head>
<body>
<div class="text">
<p>It happened in 3/15/1995.<br><p>
</div>
</div>
</body>
</html>

So, this is still not working and i tried to research if anybody have made the same question as me, Apparently I didn't found Anything

Aucun commentaire:

Enregistrer un commentaire