I've been working on a project where I need to know all of the changes made in the past day to a closed database. Luckily, two of the fields are mdl_create_time and mdl_modify_time so I have a place to start. One of the values was 1140056407. Hmm, looks like epoch time. I asked the database's GUI, and it told me Thu 16 Feb 2006 02:20:07 GMT, so I verified the language. Now I need a way to bring that into a shell script. There's always the reference in Sys Admin magazine, but that seemed like more work than I should need.
Here's the simplest answer so far: to convert from a long number to a human-readable date, use date -r 1140056407. To generate that long number, use date +%s. (And of course, to see the current date in human-readable form, use date.)
Off to see if I can finish the job in shell!
No comments:
Post a Comment