0
X
Add Snippet To Project
New Project
Add To Existing Project
<?php
<script type="text/javascript">
jQuery(document).ready(function($) {
// Function to convert timestamp to timecode format
function convertToTimecode(timestamp) {
// Convert timestamp to hours, minutes, and seconds
var time = timestamp.split(':');
var hours = parseInt(time[0], 10);
var minutes = parseInt(time[1], 10);
var seconds = 0;
// Calculate total seconds
var totalSeconds = (hours * 3600) + (minutes * 60) + seconds;
// Format timecode as hh:mm:ss
var timecode = ('0' + hours).slice(-2) + ':' + ('0' + minutes).slice(-2) + ':' + ('0' + seconds).slice(-2);
return timecode;
}
// Listen for changes in the timestamp field
$('#timestamp-field').on('input', function() {
var timestamp = $(this).val();
var timecode = convertToTimecode(timestamp);
// Update the timecode field with the converted value
$('#timecode-field').val(timecode);
});
});
</script>
