DateSerial Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone! Using A02 on XP. Got the answer I needed earlier from Van and
Marsh but now I've been asked to default to 12/31 of the PRIOR year. I have
put a minus one in every spot but it's not working.

DateSerial(Year(Date()),12,31) gives me 12/31/2006.

DateSerial(Year(Date()-1),12,31) I need 12/31/2005.

I've read the VB help and the only examples are calculating from a specific
year rather than using Date().

What am I doing wrong? I know it's gotta be really simple and I'm missing it.

Thanks in advance for any help or advice.
 
Almost right, try using DateSerial(Year(Date())-1,12,31), the -1 was in the
wrong place.

Hope this helps.
 
Hi Bonnie,
Close! DateSerial(Year(Date())-1,12,31)
 
Hi everyone! Using A02 on XP. Got the answer I needed earlier from Van and
Marsh but now I've been asked to default to 12/31 of the PRIOR year. I have
put a minus one in every spot but it's not working.

DateSerial(Year(Date()),12,31) gives me 12/31/2006.

DateSerial(Year(Date()-1),12,31) I need 12/31/2005.

I've read the VB help and the only examples are calculating from a specific
year rather than using Date().

What am I doing wrong? I know it's gotta be really simple and I'm missing it.

Thanks in advance for any help or advice.


Using DateSerial, the Zeroeth day of any month is the last day of the
previous month, so January 0, 2006 returns December 31, 2005.

DateSerial(Year(Date()),1,0)
 
Thank you very much Mr. Tapp. I really appreciate your help. I knew it was
simple.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top