# Current Year as Roman Numerals

**URL:** <https://community.textexpander.com/t/current-year-as-roman-numerals/125>\
**Category:** TextExpander Talk\
**Tags:** dates\
**Created:** [March 24, 2025, 3:40pm UTC](https://community.textexpander.com/t/current-year-as-roman-numerals/125 "2025-03-24T15:40:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![acarter](https://sea3.discourse-cdn.com/textexpander/user_avatar/community.textexpander.com/acarter/32/163_2.png) [@acarter](https://community.textexpander.com/u/acarter)\
**Post date:** [March 24, 2025, 3:40pm UTC](https://community.textexpander.com/t/current-year-as-roman-numerals/125/1 "2025-03-24T15:40:17Z")

</div>

Here is a JS to expand the current year as Roman Numerals. I use the abbreviation “cyroman”. Is there a better way to share these here?

```auto
var num = new Date().getFullYear();
var roman = {M:1000, CM:900, D:500, CD:400, C:100, XC:90, L:50, XL:40, X:10, IX:9, V:5, IV:4, I:1};
var str = "";
for (var i of Object.keys(roman)) {
    while (num >= roman[i]) { str += i; num -= roman[i]; }
}
str;

```

---

<div class="post-metadata">

**Author:** ![josh.centers](https://sea3.discourse-cdn.com/textexpander/user_avatar/community.textexpander.com/josh.centers/32/8_2.png) [@josh.centers](https://community.textexpander.com/u/josh.centers)\
**Post date:** [March 24, 2025, 5:03pm UTC](https://community.textexpander.com/t/current-year-as-roman-numerals/125/2 "2025-03-24T17:03:49Z")

</div>

Thanks, this is great! I’ve added it to the [Community Snippets Public Group](https://snippets.textexpander.com/group/fa796ecbe167aeb836aced0a65e43b94) with the abbreviation `com.roman`. We’re working on a better way to share Snippets. Stay tuned!

---

<div class="post-metadata">

**Author:** ![sreynolds](https://sea3.discourse-cdn.com/textexpander/user_avatar/community.textexpander.com/sreynolds/32/168_2.png) [@sreynolds](https://community.textexpander.com/u/sreynolds)\
**Post date:** [March 25, 2025, 1:35pm UTC](https://community.textexpander.com/t/current-year-as-roman-numerals/125/3 "2025-03-25T13:35:42Z")

</div>

This is really cool! I’d love to try it out, but I’ve honestly never scripted anything before—any chance someone could walk me through how I might use this?

---

<div class="post-metadata">

**Author:** ![josh.centers](https://sea3.discourse-cdn.com/textexpander/user_avatar/community.textexpander.com/josh.centers/32/8_2.png) [@josh.centers](https://community.textexpander.com/u/josh.centers)\
**Post date:** [March 25, 2025, 9:30pm UTC](https://community.textexpander.com/t/current-year-as-roman-numerals/125/4 "2025-03-25T21:30:01Z")

</div>

The easy solution is to subscribe to the Public Group I linked to above, but here’s a video showing how to load a script into TextExpander:

[![]() ](https://vimeo.com/1069376904)

---

<div class="post-metadata">

**Author:** ![sreynolds](https://sea3.discourse-cdn.com/textexpander/user_avatar/community.textexpander.com/sreynolds/32/168_2.png) [@sreynolds](https://community.textexpander.com/u/sreynolds)\
**Post date:** [March 31, 2025, 6:17pm UTC](https://community.textexpander.com/t/current-year-as-roman-numerals/125/5 "2025-03-31T18:17:54Z")

</div>

Thank you that helps!
