Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 2012-12-20 23:48:40

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Days and Dates

How do you attack questions like this: What was the day on 15 March, 1993?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #2 2012-12-20 23:58:18

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Days and Dates

Hi Agnishom;

Zeller's congruence is what I use.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #3 2012-12-21 00:15:36

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

Is it like modular arithmetic?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #4 2012-12-21 00:31:17

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Days and Dates

Yep!

With h as the day of the week (0 = Saturday, 1 = Sunday, 2 = Monday, ...)

q is the day of the month

m is the month (3 = March, 4 = April, 5 = May, ..., 14 = February)

K the year of the century (year mod 100)

J is the century  floor( year/100 )
For example, in 1995 the century would be 19, even though it was the 20th century.

In this algorithm January and February are counted as months 13 and 14 of the previous year. E.g. if it is February 2, 2010, the algorithm counts the date as the second day of the fourteenth month of 2009 (02/14/2009 in DD/MM/YYYY format)

This is an improvement from Wikipedia.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #5 2012-12-21 01:37:19

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

floor?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #6 2012-12-21 01:42:38

gAr
Member
Registered: 2011-01-09
Posts: 3,479

### Re: Days and Dates

Hi,

There has been a discussion before : http://mathisfunforum.com/viewtopic.php?id=15927&p=1

"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

## #7 2012-12-21 03:48:03

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

Hi gAr,

Thanks for that

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #8 2012-12-21 05:14:24

gAr
Member
Registered: 2011-01-09
Posts: 3,479

### Re: Days and Dates

You're welcome.

"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

## #9 2012-12-21 06:49:41

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Days and Dates

Hi gAr;

Missed you, I was napping.

Hi Agnishom;

Did you get a formula to work?

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #10 2012-12-22 03:40:25

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

Not yet, what does the floor function mean?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #11 2012-12-22 03:43:09

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Days and Dates

Hi;

It means round down.

floor(100.2) -> 100

floor(-3.5) -> - 4

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #12 2012-12-22 03:46:26

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

like an int() function?
I see

Catch ya, later. I am tired today

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #13 2012-12-22 03:48:10

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

Do I have to memorise the formula?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #14 2012-12-22 03:49:11

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Days and Dates

Depends on the implementation. Check to see how the language you are going to use does on the two examples I gave.

Okay, get some rest.

http://www.gregmiller.net/astro/dow.html

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #15 2012-12-22 16:24:57

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

Hmm... to do it in my head

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #16 2012-12-22 21:53:23

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Days and Dates

Hi Agnishom;

So, you want to impress people! Did you check the link I gave you?

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #17 2012-12-22 22:13:39

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #18 2012-12-22 22:14:42

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Days and Dates

There is a chart that gives a correction factor.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #19 2012-12-31 00:27:02

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

I can do it now. Thanks for helping

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #20 2012-12-31 01:53:08

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Days and Dates

Hi Agnishom;

Very good! Happy New Year to you.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #21 2012-12-31 18:44:50

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

Happy New Year

And if I haven't told already, I have returned home

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #22 2013-01-01 01:46:37

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Days and Dates

I figured that. I am glad to have helped you.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #23 2013-01-01 02:01:17

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

Thank You, bobbym.

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline

## #24 2013-01-01 02:15:44

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

### Re: Days and Dates

I have seen the solution to that awhile back but do not remember it. I will see if I had the brains to write it down somewhere. Right now, I am handling a bunch of spammers and 2 other problems. I will follow up there when I hopefully get something.

In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

## #25 2013-01-01 02:19:08

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 24,805
Website

### Re: Days and Dates

Okay..I shall be waiting... Thanks

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'
'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'
I'm not crazy, my mother had me tested.

Offline