Skip to content

Instantly share code, notes, and snippets.

@jamesmartin
Created August 23, 2011 06:49
Show Gist options
  • Save jamesmartin/1164505 to your computer and use it in GitHub Desktop.
Save jamesmartin/1164505 to your computer and use it in GitHub Desktop.
File this one in the dumb bucket.
parseInt(Date().split(" ")[4].split(":")[1]);
@jamesmartin
Copy link
Author

Javascript's Date() returns the current date, as a string, like this:

Tue Aug 23 2011 07:09:00 GMT+0100 (BST)

The code above was supposed to parse this string and return the current minute as an integer.

Of course, it returns 0 for the first ten minutes of the hour.

And that's how I learnt about new Date().getMinutes().

Know your language, kids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment