I want to parse date and time from the following time stamp in my Nuxt3 project using Date Fns. on Date select on calender, this is the value we get.
const SelectedDate = "Sat Jul 02 2022 14:56:04 GMT+0530 (India Standard Time)"
I want to extract date and time from this, like.
Const Date = "02/07/2022"
Const Time = "14:56"
but i get wrong time, as result i get -
const Time = "14:07"
I have used this.
<script setup>
import { ref, reactive } from "vue";
import { format, compareAsc } from 'date-fns'
let pickdate = ref(new Date());
const FormattedDate = ref(format(pickdate.value, 'dd/MM/yyyy'))
const FormattedTime = ref(format(pickdate.value, 'HH:MM'))
</script>