7

Here in France, midnight 00:00 is the end of the day, in English it is the beginning of the day.

In a cron table, if a batch is scheduled at 00:00 Friday, it will finish in the morning of Friday.

My question is: Does changing the locale and time locale change the definition of midnight?

If I configure a server with the french locale, will the batch scheduled at 00:00 Friday finish Saturday morning?

7
  • 1
    Be aware that days do not always start at the time 00:00. On same dates in some time zones, the day may start at another time such as 01:00. Commented Nov 27 at 4:52
  • 1
    @BasilBourque And when using some calendars as well. There are at least a few cultures that consider a day to be sunset to sunset or sunrise to sunrise. Commented Nov 27 at 5:43
  • 1
    so a day in France starts at 00:01 and ends at 00:00?
    – Tvde1
    Commented Nov 27 at 12:34
  • 2
    In UTC, by definition, 23:59:59 is the last second of the day (unless there's a leap second added, which will be 23:59:60), and 00:00:00 is the first second of the next day. The locale has no influence in this. Commented Nov 27 at 20:42
  • 1
    @Bussiere Jordan. And Palestine, Bangladesh, Iran, Japan, and more. Open the tzdata, search for 24:00. Commented Nov 28 at 23:47

1 Answer 1

12

I know common usage of « minuit » in French is midnight at the end of the day, but even with a French locale, 0:00 indicates midnight at the start of the day:

$ LC_ALL=fr_FR.UTF-8 date -d ""
mar. 26 nov. 2024 00:00:00 CET

A cron job scheduled for 0:00 on a Friday, running for less than twelve hours, will finish on the Friday morning.

7
  • 1
    Can one use 24:00 to mean the end of the day?
    – A. Rex
    Commented Nov 27 at 3:14
  • 4
    @A.Rex I would use 23:59 for the end of the day (yes, it is one minute short of the end, but it is also unambiguous). I would also use 0:01 for start. In general, using 0:00 can be confusing and is not well defined, as you have just found. "Technically" there is no such time as 24:00, but it is occasionally used to disambiguate. This is in communication between people, though, and may not apply to computers.
    – enkorvaks
    Commented Nov 27 at 5:59
  • 3
    @A.Rex no, at least not with cron — crontab allows the hour field to take values between 0 and 23 included. Commented Nov 27 at 6:44
  • 9
    @enkorvaks "00:00" is well defined. It's the start of the first minute of a day. This follows from the fact that the hours field has values in the range 0-23 and the minutes field has values in the range 0-59.
    – Kusalananda
    Commented Nov 27 at 9:19
  • 1
    @DevSolar I'm not talking about calendars. I'm talking about what range of numbers are valid in the time fields of a crontab schedule. If "of the day" is a potentially confusing concept, maybe I should have said "after midnight"?
    – Kusalananda
    Commented Nov 27 at 19:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .