Try this:
<script type="text/javascript">
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1;
var yyyy = today.getFullYear();
var tmpHour = today.getHours();
var h =tmpHour > 12 ? tmpHour - 12 + 'PM' : tmpHour + 'AM';
if (dd < 10) {
dd = '0' + dd;
}
if (mm < 10) {
mm = '0' + mm;
}
var dateString = yyyy + '-' + mm + '-' + dd + '+' + h;
var iframe = document.createElement('iframe');
iframe.setAttribute('src', 'https://example.com/display/stuff/' + dateString);
document.body.appendChild(iframe);
</script>
You had several syntax errors, and mostly you forgot to invoke the Date functions - you did not add ();
Also know that the month is always returnd -1 (it is from 0 to 11 instead of 1 to 12)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…