Solved

year problem

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now