Solved

year problem

Posted on 2004-04-02
4
211 Views
Last Modified: 2010-04-17
I what to use a 2 digit year and I want to beable to convert if you enter 04 it knows it is 2004 and if you put in 99 for 1999 it know how to convert it. can anyone help me on this?
0
Comment
Question by:cdb424ttm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 10

Accepted Solution

by:
Kavar earned 500 total points
ID: 10741427

use this function

Function GetYear(whatYear as integer) as integer
if WhatYear<31 then
  GetYear=WhatYear+2000
 else
  GetYear=WhatYear+1900
end if
End Function
0
 
LVL 10

Expert Comment

by:Kavar
ID: 10741444
or in c

int GetYear(in WhatYear)
{
  if (WhatYear<31)
 {
   return WhatYear+2000;
 }
 else
 {
   return WhatYear+1900;
 }
}
0
 

Author Comment

by:cdb424ttm
ID: 10741494
what is testing it for less then 31 do?
0
 
LVL 10

Expert Comment

by:Kavar
ID: 10741515
because you have to set a threshold somewhere and say, if this date or later, they mean 19xx and this date or sooner and they mean 20xx, I picked 31 (its pretty much an industry standard)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question