Tolz.me

Category

Developer Tools

Translate cron expressions, convert Unix timestamps, and work out file permission values.

Some chores in development are small, frequent and easy to get subtly wrong. A cron entry that fires at the wrong time, a chmod value that is one bit too generous, a timestamp stored in the wrong unit: each one works until the day it does not, and then it fails quietly in the background.

These three tools exist to take the guesswork out of those chores. The cron translator reads a five field expression back to you in plain English and lists the next run times. The chmod calculator builds a permission value from the owner, group and others bits and explains what each one allows. The timestamp converter works in seconds, milliseconds, microseconds and nanoseconds in both directions.

They are aimed at the moment of debugging rather than at building a whole pipeline. Open one, paste the value, and put the answer back into your code. The explanations are written for people who have to remember what these things meant six months ago, so each answer says what the value does as well as what it is.

How to use each tool

Three chores that are easy to get subtly wrong. Each tool reads a value you already have and hands back an answer in a form you can paste into a script, a crontab, or a log line.

Cron Expression Translator

Paste the expression into the input field. The translation updates as you type, so you can edit one field at a time and watch the sentence change.

The plain English line is the quick read. Under it, the field breakdown shows what each of the five fields contributes, in the order cron reads them: minute, hour, day of month, month, day of week.

Check the next ten run times in your own timezone. That list is the fastest way to catch a schedule which fires at the wrong hour.

Copy the sentence when you need to explain the schedule to somebody, or copy the run list when you are checking a deployment window. The preset buttons fill in the schedules people ask about most.

Tip: Read the day of month and day of week fields together. When both are restricted, cron runs the job whenever either one matches rather than only when both do, and that rule is the one that surprises people.

Chmod Calculator

Start with the grid. Three rows for owner, group, and others, three columns for read, write, and execute. Tick what you want and the octal number, the symbolic string, and the chmod commands update straight away.

Or type into the three fields below the grid. An octal number such as 755 or 4755 fills the grid, a symbolic string such as rwxr-xr-x does the same, and you can paste the permission part of an ls -l line with or without the leading file type character.

Set the file name at the bottom to get a command you can paste into a terminal. The tool always gives two, one with the octal number and one with the symbolic form, which reads better for whoever maintains it later.

Tip: Check what a mode costs before you widen it. 644 is a sensible default for public files and a bad one for a private key, and 777 lets every account on the machine change the file.

Unix Timestamp Converter

For a number, paste it into the timestamp tab. The converter reads the unit from the size of the number, ten digits for seconds and thirteen for milliseconds, and you can override the guess when it is wrong.

You get the UTC time, the time in your browser's timezone, the ISO 8601 string, a relative phrase such as in 3 hours, and the same value written back in seconds and milliseconds.

For a date, switch to the date tab and pick a date and time. The output shows both the local reading and the UTC value, which is the one you normally store.

The counter at the top shows the current timestamp, and the snippets panel has the one-liner for JavaScript, Python, Bash, and SQL.

Tip: If a date comes out in 1970 or in the year 56000, the unit is wrong rather than the value. A number a thousand times too large is milliseconds that were read as seconds.

Common jobs and the tool for each one

  • Read a cron expression

    Turns a five field cron line into plain English and shows the next few times it will run so you can sanity check it.

  • Work out a chmod value

    Builds modes such as 755, 644, 600 or 700 from the owner, group and others bits, and explains what each permission allows.

  • Convert a timestamp

    Converts Unix seconds, milliseconds, microseconds and nanoseconds into dates and back, with UTC, local time and a relative reading.

How to choose the right tool

These three answer different questions, and the value you already have usually points at the right one.

You have a crontab line you do not trust

Open the cron translator. Read the sentence back, then compare the next run times with what you expected. It also points out the day of month and day of week trap.

You are working out a mode

Use the chmod calculator. Read the octal number, the symbolic string, and what each digit allows, then take the command once you are happy with it.

You have a number from a log or an API

Use the timestamp converter. It detects the unit, shows the same moment in UTC, in your timezone, and as an ISO string, and it goes back the other way when you need to store a value.

More than one of these turned up in the same bug

Work from the symptom. A job that fires at the wrong time is a timezone question, so check the cron run list first. A file nobody can read is a permission question, so check the mode.

Frequently asked questions

What does 755 actually mean?+

Read the three digits as owner, group and others. 7 is read, write and execute, 5 is read and execute. So 755 gives the owner full access, and gives the group and everyone else the right to read and run the file, but not to change it. A plain script that only needs to be read is 644, where the last digit is 4, read only.

Does cron use my timezone?+

It depends on the machine running the job. Most servers use UTC unless the cron daemon or the host is configured for something else, and that setting is not visible from the browser. The translator shows the next runs in your local time and in UTC so you can spot a mismatch.

Are timestamps in seconds or milliseconds?+

Unix seconds are ten digits, milliseconds are thirteen, and microseconds and nanoseconds run longer still. The converter detects the unit from the size of the number and shows you which one it chose, and you can override that if the guess is wrong.

Why does a 32-bit timestamp stop working in 2038?+

A signed 32 bit integer runs out at 2,147,483,647 seconds, which lands on 19 January 2038. Anything you build today should store time as a 64 bit value, a database timestamp type, or an ISO 8601 string.

Is the fifth cron field the day of the week?+

It is the day of the week, and it is the field that catches people out. When you set both the day of the month and the day of the week, cron runs the job whenever either one matches, not only when both do. The translator spells out which rule applies to the expression you pasted.

Does the chmod calculator handle symbolic modes?+

It is built around the numeric form, so you type or pick the permission bits and read back the three digit value with an explanation of each digit. It is meant for working out what a mode means, not for editing a file on a server.