How do I set/change the hour and/or minute of a DateTime object. Similar to Date.setHours(..)
in JavaScript.
e.g If i did
var time = DateTime.parse("2018-08-16T11:00:00.000Z");
how do I set the hour and minute of time
var newHour = 5; time = time. toLocal(); time = new DateTime(time. year, time. month, time.
var newHour = 5; time = time.toLocal(); time = new DateTime(time.year, time.month, time.day, newHour, time.minute, time.second, time.millisecond, time.microsecond);
There were discussions to add an update()
method that allows to modify specific parts only, but it doesn't look like this has landed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With