You should be able to call getMilliseconds without having to flatmap. Converting from a long to an int isn't a good thing either, so I would just leave it as a long.

Thanks!