can javascript change the date format taken from php like this: 2018-09-22 05:20:48
to like this Saturday,22 September
? iam using vue.js and laravel. because this date is taken from the database using a query i dont know how to get int time and it will be passing to vue component.
Vue Component :
<tr v-for="(category,index) in allCategories">
<td class="v-align-middle"> <img :src="category.images[0].link" class="img-fluid categoriesImg" alt=""> </td>
<td class="v-align-middle">{{category.category}}</td>
<td class="v-align-middle">{{formatDate(category.created_at)}}</td>
</tr>
<script>
import {mapGetters} from 'vuex';
export default {
name:"category",
computed: {
...mapGetters({
allCategories:'allCategories'
}),
},
created(){
// this.$swal('Hello Vue world!!!');
this.$store.dispatch('GetAllCategories');
},
methods:{
formatDate(date){
let tanggal = new Date(date);
return tanggal;
},
}
}
</script>
Result
"2018-09-21T22:20:48.000Z"