• MRAB (unregistered)

    Why is the first function called 'GetTimeStamp'? It's not getting the timestamp, it's formatting a timestamp that its caller is passing in.

    Oh, and frist!

  • (nodebb)

    99 milliseconds should be enough for anyone.

  • (nodebb)

    Copy pasta is the favorite food of bad programmers everywhere.

  • Richard Brantley (unregistered)

    What amazes me about this kind of thing, so constantly, is that .NET comes with the most “batteries included” functions for so many things, date/time handing being exceptionally rich. But a lot of junior devs don’t bother to learn the framework, or maybe spend a minute in a search engine asking “has someone else in the history of programming ever solved this problem before?”

  • Tinkle (unregistered)

    Hmm, a one-liner that does the same.

    private string FileTimeStamp(DateTime param) { return param.Year.ToString() + "-" + ((param.Month < 10) ? "0" : "") + param.Month.ToString() + "-" + ((param.Day < 10) ? "0" : "") + param.Day.ToString() + " " + ((param.Hour < 10) ? "0" : "") + param.Hour.ToString() + ":" + ((param.Minute < 10) ? "0" : "") + param.Minute.ToString() + ":" + ((param.Second < 10) ? "0" : "") + param.Second.ToString() + "." + ((param.Millisecond < 10) ? "0" : "") + param.Millisecond.ToString(); }

    Gotta be right?

  • Joe (unregistered) in reply to Richard Brantley

    Maybe this code was ported from a language that doesn't have good formatting built-in like .NET, and the ones doing the porting wanted to be as hands-off as possible, just a theory. Think about it - if you need the new system to behave exactly as the old system, you're gonna need to keep that milliseconds bug in there :-)

  • (nodebb)

    string retDate = param.Year.ToString() + "-";

    TRWTF is they didn't use var there, right?

  • (nodebb) in reply to Dragnslcr

    That attitude will not get you any second dates (of the woman kind)

Leave a comment on “A Second Date”

Log In or post as a guest

Replying to comment #:

« Return to Article