# Why do we need to prefix module name with Julia function sometimes to make it work?

**URL:** <https://discourse.julialang.org/t/why-do-we-need-to-prefix-module-name-with-julia-function-sometimes-to-make-it-work/60949>\
**Category:** General Usage\
**Tags:** module, function\
**Created:** [May 11, 2021, 1:16pm UTC](https://discourse.julialang.org/t/why-do-we-need-to-prefix-module-name-with-julia-function-sometimes-to-make-it-work/60949 "2021-05-11T13:16:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shubh\_b](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/shubh_b/32/20697_2.png) [@shubh\_b](https://discourse.julialang.org/u/shubh_b)\
**Post date:** [May 11, 2021, 1:16pm UTC](https://discourse.julialang.org/t/why-do-we-need-to-prefix-module-name-with-julia-function-sometimes-to-make-it-work/60949/1 "2021-05-11T13:16:52Z")

</div>

As example, here is a `DateTime` object declared below using `Dates` module:

```julia
julia> using Dates

julia> dt = DateTime(2021, 05, 11, 18, 21, 50)
2021-05-11T18:21:50

```

We can find the Hour value of `dt` simply using `hour()` function from `Dates` module:

```julia
julia> hour(dt)
18

```

We can prefix the module name with `hour()` function also:

```julia
julia> Dates.hour(dt)
18

```

Now, if we try to use `format()` function from `Dates` module as below:

```julia
julia> format(dt, "e, H:M:S dd-u-yyyy")
ERROR: UndefVarError: format not defined

```

it throws error. We need to prefix module name here to make it work:

```julia
julia> Dates.format(dt, "e, H:M:S dd-u-yyyy")
"Tue, 18:21:50 11-May-2021"

```

Why do some functions in Julia need to be prefixed by the module name to work?

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [May 11, 2021, 1:19pm UTC](https://discourse.julialang.org/t/why-do-we-need-to-prefix-module-name-with-julia-function-sometimes-to-make-it-work/60949/2 "2021-05-11T13:19:21Z")

</div>

`using Dates` brings only the functions and types which were labeled with `export` inside the `Dates` module. For more about `export` and `using`, see: [Modules · The Julia Language](https://docs.julialang.org/en/v1/manual/modules/#Export-lists)
