# \[?\]  Avoid problem with Units Seconds vs. s?

**URL:** <https://community.wolfram.com/t/avoid-problem-with-units-seconds-vs-s/10420>\
**Category:** Questions\
**Tags:** units\
**Created:** [April 27, 2017, 3:55pm UTC](https://community.wolfram.com/t/avoid-problem-with-units-seconds-vs-s/10420 "2017-04-27T15:55:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscholz](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@oscholz](https://community.wolfram.com/u/oscholz)\
**Post date:** [April 27, 2017, 3:55pm UTC](https://community.wolfram.com/t/avoid-problem-with-units-seconds-vs-s/10420/1 "2017-04-27T15:55:38Z")

</div>

This ist only my first simple steps to build a computation to dimension an upload service. Even the first steps are not easy.  
If i am evaluating this:

```
uploadtime[filesize_, bandwidth_] := (filesize / bandwidth)
uploadtime[UnitConvert[Quantity[12770776, "Bytes"], "Megabits"], 
 Quantity[2.4, "Megabits"/"Seconds"]]

```

I am getting this:

```
Quantity[42.5693, "Seconds"]

```

If I am evaluating this:

```
Convert[Month, Second]

```

I am getting this:

```
2628000 Second

```

If I am mulitplying both results I am getting:

```
Second (Quantity[52560000, ("Megabits")/("Seconds")])

```

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![seanc](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/seanc/32/34005_2.png) [@seanc](https://community.wolfram.com/u/seanc)\
**Post date:** [April 27, 2017, 5:12pm UTC](https://community.wolfram.com/t/avoid-problem-with-units-seconds-vs-s/10420/2 "2017-04-27T17:12:11Z")

</div>

First, you wrote this function:

```
uploadtime[filesize_, bandwidth_] := (filesize/bandwidth);

```

You can use this function with Quantities. For example,

```
uploadtime[
    Quantity[12770776, "Bytes"], 
    Quantity[2.4, "Megabits"/"Seconds"]]

Quantity[42.5693, "Seconds"]

```

As you can see, there is no need to call UnitConvert. The division operation handles unit conversion automatically.

You mentioned that you also evaluated:

```
 UnitConvert["Month", "Second"]

 Quantity[2628000, "Seconds"]

```

Is this correct?

Can you type-out what calculation seems to not be working for you?

---

<div class="post-metadata">

**Author:** ![oscholz](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@oscholz](https://community.wolfram.com/u/oscholz)\
**Post date:** [April 28, 2017, 7:16am UTC](https://community.wolfram.com/t/avoid-problem-with-units-seconds-vs-s/10420/3 "2017-04-28T07:16:37Z")

</div>

Needs[“Units`”]  
Convert[Month, Second]  
Out[1] 2628000 Second  
Quantity[20, “Megabits”/“Seconds”] \* Convert[Month, Second]  
Out[2] Second (Quantity[52560000, (“Megabits”)/(“Seconds”)])

I expected to have only one unit of Seconds either Second or s and not both of them

---

<div class="post-metadata">

**Author:** ![seanc](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/seanc/32/34005_2.png) [@seanc](https://community.wolfram.com/u/seanc)\
**Post date:** [April 28, 2017, 2:06pm UTC](https://community.wolfram.com/t/avoid-problem-with-units-seconds-vs-s/10420/4 "2017-04-28T14:06:19Z")

</div>

Can you try formatting your code? It’s hard to read and I’m not sure I am understanding what you are doing.

You can format your code by highlighting and clicking the “code sample” button. The code sample button is the first button above the text input field:

![ScreenShot2017-04-28at9.04.43AM.png](https://global.discourse-cdn.com/wolfram/original/3X/a/2/a271291560acebaadf9e879e9645f7a223168497.png)

It looks like you are typing out “Second” by itself instead of typing Quantity[2628000, “Seconds”].

---

<div class="post-metadata">

**Author:** ![wolframcommunity](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/wolframcommunity/32/8335_2.png) [@wolframcommunity](https://community.wolfram.com/u/wolframcommunity)\
**Post date:** [April 28, 2017, 2:20pm UTC](https://community.wolfram.com/t/avoid-problem-with-units-seconds-vs-s/10420/5 "2017-04-28T14:20:36Z")

</div>

Welcome to Wolfram Community! Please make sure you know the rules and how to format code properly, which you can find here: [https://wolfr.am/READ-1ST](https://wolfr.am/READ-1ST) Not formatting your code can make it unusable to other members. Please respect forum rules.

---

<div class="post-metadata">

**Author:** ![oscholz](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@oscholz](https://community.wolfram.com/u/oscholz)\
**Post date:** [May 2, 2017, 7:15am UTC](https://community.wolfram.com/t/avoid-problem-with-units-seconds-vs-s/10420/6 "2017-05-02T07:15:50Z")

</div>

Convert[Month, Second]  
Quantity[20, “Megabits”/“Seconds”]  
%1 \* %2

---

<div class="post-metadata">

**Author:** ![oscholz](https://avatars.discourse-cdn.com/v4/letter/o/ecae2f/32.png) [@oscholz](https://community.wolfram.com/u/oscholz)\
**Post date:** [May 2, 2017, 7:18am UTC](https://community.wolfram.com/t/avoid-problem-with-units-seconds-vs-s/10420/7 "2017-05-02T07:18:55Z")

</div>

The last evaluates to:  
Second (Quantity[52560000, (“Megabits”)/(“Seconds”)])  
Why is there a Megabits / Seconds and Second as an result. I would expect that Convert[Month, Second] should evaluate to something which is a number of Seconds.

---

<div class="post-metadata">

**Author:** ![sghuisman](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sghuisman/32/27850_2.png) [@sghuisman](https://community.wolfram.com/u/sghuisman)\
**Post date:** [May 2, 2017, 8:35am UTC](https://community.wolfram.com/t/avoid-problem-with-units-seconds-vs-s/10420/8 "2017-05-02T08:35:49Z")

</div>

You’re mixing two packages, the built-in functionality and the one from (the very old) Units. Try not to use the Units package any more, everything is now built-in, use the functions:

```
UnitConvert (*also to 'simplify' *)
Quantity
QuantityMagnitude

```
