Solved

year problem

Posted on 2004-04-02
4
210 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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 …

730 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