Datetime vector to binary/logical "night" and "day" vector

It seems the sample data you have provided doesn't actually represent your real data and the resulting time format is not valid. Can you provide a sample of your actual data set? or even better, a proper REPRoducible EXample (reprex) illustrating your issue?