# How would I display a seconds value as SI years?

**URL:** <https://community.openastronomy.org/t/how-would-i-display-a-seconds-value-as-si-years/457>\
**Category:** Astropy\
**Created:** [September 20, 2022, 10:48am UTC](https://community.openastronomy.org/t/how-would-i-display-a-seconds-value-as-si-years/457 "2022-09-20T10:48:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaughan](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/cmaughan/32/276_2.png) [@cmaughan](https://community.openastronomy.org/u/cmaughan)\
**Post date:** [September 20, 2022, 10:48am UTC](https://community.openastronomy.org/t/how-would-i-display-a-seconds-value-as-si-years/457/1 "2022-09-20T10:48:13Z")

</div>

val = 100000000 \* u.s  
print(val.to(units.yr) ) # Year, non-SI  
print(val.to(units.yr).si) # Returns seconds!

I’m sure there’s something obvious I’m missing here…

---

<div class="post-metadata">

**Author:** ![ayshih](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/ayshih/32/84_2.png) [@ayshih](https://community.openastronomy.org/u/ayshih)\
**Post date:** [September 20, 2022, 1:50pm UTC](https://community.openastronomy.org/t/how-would-i-display-a-seconds-value-as-si-years/457/2 "2022-09-20T13:50:47Z")

</div>

As far as I know, there is no such thing as an “SI year”. A year is a non-SI unit, and – unlike the non-SI time units of minute, hour, or day – it’s not even one of the non-SI units that are officially accepted for use with SI (see [Non-SI units mentioned in the SI - Wikipedia](https://en.wikipedia.org/wiki/Non-SI_units_mentioned_in_the_SI#Units_officially_accepted_for_use_with_the_SI), or Section 4 of the [SI Brochure](https://www.bipm.org/documents/20126/41483022/SI-Brochure-9.pdf)). Can you elaborate on what you expected that call to return?

---

<div class="post-metadata">

**Author:** ![cmaughan](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/cmaughan/32/276_2.png) [@cmaughan](https://community.openastronomy.org/u/cmaughan)\
**Post date:** [September 20, 2022, 2:29pm UTC](https://community.openastronomy.org/t/how-would-i-display-a-seconds-value-as-si-years/457/3 "2022-09-20T14:29:33Z")

</div>

So my understanding of ‘SI’ (Scientific Notation?) is that you get a number like this:  
3 \* 10^6 seconds.  
And if I do  
val.to(units.yr).si  
I get something like that in seconds:  
x \* 10^y _seconds_  
But what I want to display is the number of years in the same format:  
x \* 10^y _years_

So it’s easy to convert to years, but I seem to get the implicit conversion back to seconds.

---

<div class="post-metadata">

**Author:** ![cmaughan](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/cmaughan/32/276_2.png) [@cmaughan](https://community.openastronomy.org/u/cmaughan)\
**Post date:** [September 20, 2022, 2:33pm UTC](https://community.openastronomy.org/t/how-would-i-display-a-seconds-value-as-si-years/457/4 "2022-09-20T14:33:24Z")

</div>

It seems that:  
print(“{:e}”.format(val.to(units.yr)))  
gives me what I was after.

---

<div class="post-metadata">

**Author:** ![dhomeier](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/dhomeier/32/65_2.png) [@dhomeier](https://community.openastronomy.org/u/dhomeier)\
**Post date:** [September 23, 2022, 8:34am UTC](https://community.openastronomy.org/t/how-would-i-display-a-seconds-value-as-si-years/457/5 "2022-09-23T08:34:28Z")

</div>

SI = _Système international_, this describes the set of units (see link above); it has nothing to do with the formatting of the numbers.

---

<div class="post-metadata">

**Author:** ![cmaughan](https://dub1.discourse-cdn.com/flex005/user_avatar/community.openastronomy.org/cmaughan/32/276_2.png) [@cmaughan](https://community.openastronomy.org/u/cmaughan)\
**Post date:** [September 23, 2022, 9:46am UTC](https://community.openastronomy.org/t/how-would-i-display-a-seconds-value-as-si-years/457/6 "2022-09-23T09:46:52Z")

</div>

Yeah, I thought it meant ‘scientific notation’, hence the confusion!
