A Dart function to get the current date/time in a “seconds since the epoch” format

As a brief note, if you need a Dart function to get the current date/time in a “seconds since the epoch” format, I can confirm that this function works:

/// the current time, in “seconds since the epoch”
static int currentTimeInSeconds() {
    var ms = (new;
    return (ms / 1000).round();
If you sit next to your date you can hold hands alvin October 6, 2019 - 10:09am

When I was meditating this morning I remembered going on a first date with a girl in high school. We went to a nice restaurant — it had tablecloths and silverware — I don’t currently remember the name of, and sat across from each other at a small, round table.

After a very short while a young boy came up to us and asked, “Are you on a first date?”

My date and I looked at him and said, “Yes, we are.” I started to look around to see where the boy came from, but I couldn’t figure that out.

“It’s okay if you sit closer to each other,” he said.

“Really,” we replied, looking at each other and smiling with surprise.

So I got up and moved my chair around the table until my date and I sat next to each other. “Is that good,” I asked.

“Much better,” he said. “This way you can hold hands.” And then he left.

Using a SQLite date/time field with Flutter and Dart

As a brief note, SQLite doesn’t have date/time (datetime) fields, so when you want to use a datetime field with Flutter (and Dart), you have to do something else.

My choice was to store my datetime data as a SQLite INTEGER field. I did this so I can query and sort that field easily myself. (The benefit of storing a datetime field as a TEXT field is that you can read it easier, but I think an INTEGER field is a little easier to work with, though YMMV.)

My disability fraud neighbor finally got a job

My disability fraud neighbor finally got a job. I'd like to think it had something to do with my motivational speaking, but I think what really happened was that he needed some money to go on a date.

~ a note from Wasilla, Alaska, August 31, 2010

Linux/Unix: How to copy a directory and save the date/time file information alvin April 29, 2019 - 10:57am

If you need to copy a directory on Unix/Linux and want to preserve the date/time information while copying the directory and files, use the -p option to save the date/time information, and the -r option to copy the directory properly. For instance, I just used this cp command to copy a directory named OldDir to a new directory named NewDir, while retaining all of the date/time file information:

How to get the current year as an integer in Scala

Scala FAQ: How do I get the current year as an integer (Int value) in Scala?

Solution: Use the Java 8 Year or LocalDate classes, or the older old Java Calendar class. The solutions are shown below.

Some Scala Long, Date, and SimpleDateFormat examples alvin May 6, 2018 - 3:03pm

At some point I’ll get all of my Scala “date utilities” together in a single class (object, actually), but until then, here are a couple of date utility methods I wrote for my Scrupal6 project (a replacement for Drupal 6):

In Scala, how to get the day of the year

Scala date FAQ: How do I determine the day of the year in Scala?

Solution: Use the Java Calendar class, as shown here:

scala> import java.util.Calendar
import java.util.Calendar

scala> Calendar.getInstance.get(Calendar.DAY_OF_YEAR)
res0: Int = 104

I’m writing this on April 14, 2018, which is the 104th day of the year.