Help me please!
-
PIEBALDconsult wrote:
This is where the C pre-processor really comes into its own; # define YearNow (System.DateTime.Now.Year % 100)
How about:
int YearNow {get { return DateTime.Now.Year % 100; }}
Dont need a macro ;P
xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 2 out nowD'oh! Of course, silly me.
-
PIEBALDconsult wrote:
But, of course one should not use two-digit years anyway.
This code is a part of a 'just as bad' bigger section. It compares the expiry date of a credit card with today's date. Needless to say it uses the same style of Reductio ad absurdum[^] logic.
xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 2 out nowThere was a problem I had to fix in similar code a few years ago. The credit card validation code compared the year, and if it was greater than the current year it didn't bother checking the month. Seems reasonable, right? But some of the cards we encountered had 00 for the month...
-
There was a problem I had to fix in similar code a few years ago. The credit card validation code compared the year, and if it was greater than the current year it didn't bother checking the month. Seems reasonable, right? But some of the cards we encountered had 00 for the month...
-
I have crap like the following scattered all over my code base!!!! I am spending more time rewriting absurd code than getting stuff done! :sigh:
Int32 YearNow = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2, 2));
Int32 MonthNow = Convert.ToInt16(DateTime.Now.Month.ToString());xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 2 out nowAmazing, indeed.
leppie wrote:
Int32 YearNow = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2, 2));
OK, someone doesn't know what modulo is.
leppie wrote:
Int32 MonthNow = Convert.ToInt16(DateTime.Now.Month.ToString());
Sorry, I don't get it. It's just... strange?
Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
-
PIEBALDconsult wrote:
But some of the cards we encountered had 00 for the month...
Ouch! I will have to investigate (dont think we even have that option in the dropdown ;P )
xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 2 out nowThese were values from the card swipe, not entered in a GUI.
-
I have crap like the following scattered all over my code base!!!! I am spending more time rewriting absurd code than getting stuff done! :sigh:
Int32 YearNow = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2, 2));
Int32 MonthNow = Convert.ToInt16(DateTime.Now.Month.ToString());xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 2 out now -
I have crap like the following scattered all over my code base!!!! I am spending more time rewriting absurd code than getting stuff done! :sigh:
Int32 YearNow = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2, 2));
Int32 MonthNow = Convert.ToInt16(DateTime.Now.Month.ToString());xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 2 out now -
I have crap like the following scattered all over my code base!!!! I am spending more time rewriting absurd code than getting stuff done! :sigh:
Int32 YearNow = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2, 2));
Int32 MonthNow = Convert.ToInt16(DateTime.Now.Month.ToString());xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 2 out nowHere you go[^]! That can solve your problem! ;P
-
I have crap like the following scattered all over my code base!!!! I am spending more time rewriting absurd code than getting stuff done! :sigh:
Int32 YearNow = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2, 2));
Int32 MonthNow = Convert.ToInt16(DateTime.Now.Month.ToString());xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 2 out nowPeople will start worring about the end of the world again in Y2.1K :doh:
-
I have crap like the following scattered all over my code base!!!! I am spending more time rewriting absurd code than getting stuff done! :sigh:
Int32 YearNow = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2, 2));
Int32 MonthNow = Convert.ToInt16(DateTime.Now.Month.ToString());xacc.ide - now with IronScheme support
IronScheme - 1.0 alpha 2 out nowleppie wrote:
I have crap like the following scattered all over my code base!!!! I am spending more time rewriting absurd code than getting stuff done! Int32 YearNow = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2, 2));Int32 MonthNow = Convert.ToInt16(DateTime.Now.Month.ToString());
Weird. Very Weird. You're converting an Int32 to a string which becomes an Int16 and that gets promoted to an Int32? :wtf:
People using Windows XP are still living in 2001.