I am using Joomla and attempting to use the substring()
function to pull out the first 4 characters of my string. The issue I am having is that I get an error of
This is my syntax - how should I change it so that it functions in my Joomla set-up?
Uncaught TypeError: phpdate.substring is not a function
Here is syntax:
<?php
$randardate = '20160301';
?>
<script>
var phpdate = <?php echo $randardate; ?>;
var yearfromphpdate = phpdate.substring(0,4);
</script>