This functionality works, yes.

My question is, whether there is an ootb way to do this, instead of having to script it myself? If there is a 'getByFormat' function for the GlideDateTime object? The fact that I cannot find it is confusing, since it seems to be easy to create. So I wonder why they did not do so. There might be a reason behind this? Some issue I am possibly overlooking?