Situation:
I am using the piece of code below to fetch the content of a text field in my database and it works. The field “title” will be fetched.
let currentItem = $w('#segmentViewerFlightsDataset').getCurrentItem();
$w('#title').text = currentItem.title;
Question.
I would also like to fetch a field that contains a date and another field that contains a time. How would I adjust the below lines of code from text to a date and to a time field?
$w('#title').text = currentItem.fromDate;
$w('#title').text = currentItem.fromTime;
Product:
Editor X
From your question I assume your database has a fromDate field with type Date and a fromTime field with a type Time?
If so, you can check out the wixData docs where they mention that Dates are stored as JavaScript Date objects, so you can just call a currentItem.fromDate.toString() to get a string to plug into the text field. Time data is stored as string with HH.mm.ss.SSS format so you’d have to either pluck out the numbers you want (e.g. split the string by “.” then pull out the first 2 numbers for hours and minutes) or just throw the entire string in if that suits your purpose.
Try this 
// Assuming currentItem.fromDate is something like "2021-08-17" (ISO date format)
// and currentItem.fromTime is in 24-hour format like "14:30"
let currentItem = $w('#segmentViewerFlightsDataset').getCurrentItem();
// Fetch and display the date
let date = new Date(currentItem.fromDate);
$w('#dateText').text = date.toLocaleDateString('en-US'); // Adjust 'en-US' to your locale
// Assuming fromTime is a string like "14:30" and you want to display it directly
$w('#timeText').text = currentItem.fromTime; // Directly assigning the time string