Reversing DateSerial

  • Thread starter Thread starter Krisse
  • Start date Start date
K

Krisse

I can calculate a serial day of the year with DateSerial,
but how do I calculate a month and day from the serial day?

Example 365 = 12/31

Thanks!
 
For a given year, you might use an expression something like this:

DateAdd("d", [Serial Day] - 1, DateSerial([Year], 1, 1))

or simply

DateSerial([Year], 1, 1) + [Serial Day] - 1

to calculate the date for a given serial day. You might then use the Month
and Day functions on the result to determine the month and day.
 
Actually, DateSerial([Year], 0, [Serial Day]) will work as well.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Brian Camire said:
For a given year, you might use an expression something like this:

DateAdd("d", [Serial Day] - 1, DateSerial([Year], 1, 1))

or simply

DateSerial([Year], 1, 1) + [Serial Day] - 1

to calculate the date for a given serial day. You might then use the Month
and Day functions on the result to determine the month and day.

Krisse said:
I can calculate a serial day of the year with DateSerial,
but how do I calculate a month and day from the serial day?

Example 365 = 12/31

Thanks!
 
Thanks, Brian! (I used the second one.)
-----Original Message-----
For a given year, you might use an expression something like this:

DateAdd("d", [Serial Day] - 1, DateSerial([Year], 1, 1))

or simply

DateSerial([Year], 1, 1) + [Serial Day] - 1

to calculate the date for a given serial day. You might then use the Month
and Day functions on the result to determine the month and day.

I can calculate a serial day of the year with DateSerial,
but how do I calculate a month and day from the serial day?

Example 365 = 12/31

Thanks!


.
 
Thanks, Douglas!

-----Original Message-----
Actually, DateSerial([Year], 0, [Serial Day]) will work as well.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Brian Camire said:
For a given year, you might use an expression something like this:

DateAdd("d", [Serial Day] - 1, DateSerial([Year], 1, 1))

or simply

DateSerial([Year], 1, 1) + [Serial Day] - 1

to calculate the date for a given serial day. You
might then use the
Month
and Day functions on the result to determine the month and day.


.
 
Back
Top