Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

year problem

Posted on 2004-04-02
4
Medium Priority
?
216 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 2000 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.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Six Sigma Control Plans
Starting up a Project

618 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