I have been researching about if I have date in a separate string as
date = 18-9-2018
and time as
time= 01:50 PM
and if I want to create a time stamp of the above two variables how i am supposed to have that?
The problem in hand is that I am receiving those variables from an API end point and i need to have the exact time stamp so that i could use them as local reminder notifications on exact that time and date!
here is what i have tried so far
createTheLocalAlert(appointments) {
// Schedule delayed notification
appointments.description.forEach(appointment => {
let notificationText =
`you have meeting with ${appointment.name} today at ${appointment.meeting_start}`;
let theDate = appointment.appointment_date.split("-");
let newDate = theDate[1] + "/" + theDate[0] + "/" + theDate[2];
let DateWithTime = newDate + appointment.meeting_start;
// alert(new Date(newDate).getTime()); //will alert 1330210800000
// console.warn("theTime_is===>" + new Date(DateWithTime));
this.localNotifications.schedule({
text: notificationText,
trigger: {at: new Date(new Date(DateWithTime).getTime() - 7200)}, // 2 hours before meetup
led: 'FF0000',
vibrate: true,
icon: 'assets/imgs/logo.jpg',
sound: null
});
});
}
I am able to convert the date into stamp but I am un able to figure out a way of adding the time into the date and parse out exact time Stamp on that date and time .
**
Any kind of help will be highly appreciated.