Formatting date

(imported topic written by mleeser91)

Here’s an easy one for somebody (except apparently me that is). I’m trying to rename a file with the current date appended. I’ve gotten this far:

move filename to filename.{(year of it as string & month of it as two digits & day_of_month of it as two digits) of date (local time zone) of now}

That gives me: filename.20090521

How can I also append the time to that so it would be something like filename.200905211330 (at 1:30 PM on 5/21/09) or ideally filename.090521-1330

(imported comment written by NoahSalzman)

The first example will get you what you need, the others are just for reference:

Q: (year of it as string & month of it as two digits & day_of_month of it as string) of current date & “-” & concatenation of characters (0; 1; 3; 4) of (current time_of_day as string)

A: 20090521-0933

Q: concatenation of characters (0; 1; 3; 4; 6; 7) of (current time_of_day as string)

A: 091055

Q: current time_of_day (local time zone)

A: 09:10:55 -0700

Q: time of current time_of_day

A: 09:10:55

Q: two digit hour of time (local time zone) of now

A: 09

Q: two digit minute of time (local time zone) of now

A: 10

Q: two digit second of time (local time zone) of now

A: 55

(imported comment written by mleeser91)

Thank you very much! I couldn’t get that syntax right.