# Modify beginning\_of\_week?

**URL:** <https://www.ruby-forum.com/t/modify-beginning-of-week/161511>\
**Category:** Rails\
**Created:** [February 27, 2009, 1:58am UTC](https://www.ruby-forum.com/t/modify-beginning-of-week/161511 "2009-02-27T01:58:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![loader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5daacb/32.png) [@loader](https://www.ruby-forum.com/u/loader)\
**Post date:** [February 27, 2009, 1:58am UTC](https://www.ruby-forum.com/t/modify-beginning-of-week/161511/1 "2009-02-27T01:58:00Z")

</div>

Hello everyone!

Is it possible to modify this function: beginning\_of\_week?

What I want is something like this :  
beginning\_of\_week(0) returns Sunday  
beginning\_of\_week(1) returns Monday

Thank you!

---

<div class="post-metadata">

**Author:** ![loader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5daacb/32.png) [@loader](https://www.ruby-forum.com/u/loader)\
**Post date:** [February 27, 2009, 10:24am UTC](https://www.ruby-forum.com/t/modify-beginning-of-week/161511/2 "2009-02-27T10:24:48Z")

</div>

What’s the argument that you’re passing the method?

Just an integer?

On Feb 27, 12:58 am, Guillaume L. \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![loader](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/5daacb/32.png) [@loader](https://www.ruby-forum.com/u/loader)\
**Post date:** [February 27, 2009, 8:53pm UTC](https://www.ruby-forum.com/t/modify-beginning-of-week/161511/3 "2009-02-27T20:53:37Z")

</div>

I see 2 ways you could do this

1. Re-open the class that offers the functionality and add your code  
to modify the behavior. I would not recommend that. I like leaving  
code that I didn’t write as it is.
2. Create something very simple that receives the parameter you need  
and acts accordingly to use the existing beginning\_of\_week behavior  
and get what you want.

On Feb 26, 7:58 pm, Guillaume L. \<rails-mailing-l…@andreas-
