Add date and time to file name when downloading a project


#1

Quick suggestion: How about adding the current date and time to the file name of a downloaded project?

This way, if you’re keeping backups through downloading (say you don’t want to put your project on GitHub), it makes it easier to keep things organized if you have multiple versions of your project.


#2

Glitch also makes checkpoints every so often, and you can do a git add . && git commit -m 'Checkpoint' in the console to make one when you’re ready.


#3

Okay, I added the date and time to the filename.


#4

Date is awesome, thanks! … but is it me or the date is not only wrong/off, but also very inconsistent?

On my downloads, I will get ‘xxxxx-2017-07-03_162821.tgz’ today, and received ‘xxxxx-2017-07-05_xxxxx.tgz’ yesterday and ’ ‘xxxxx-2017-07-04_xxxxxx.tgz’ the other day.

The only way I can make sense of them is to rely on my Windows ‘file date’ (when created/modified).


#5

This one’s actually kind of amusing, so I thought I would share the code:

timestamp = pad(now.getFullYear()) +
          "-" + pad(now.getMonth()) +
          "-" + pad(now.getDay()) +
          "_" + "#{pad(now.getHours())}#{pad(now.getMinutes())}#{pad(now.getSeconds())}"

That’s the code I had to add the timestamp, and I guess I didn’t look too closely at the results when I tried it. :confused: It turns out there are two dumb things here - getMonth() returns a zero-based month, so it will be off by one, and getDay() returns the day of the week - I wanted getDate() instead.

It’s fixed now.