Why does “%-d”, or “%-e” remove the leading space or zero?

Python datetime.strftime() delegates to C strftime() function that is platform-dependent: The full set of format codes supported varies across platforms, because Python calls the platform C library’s strftime() function, and platform variations are common. To see the full set of format codes supported on your platform, consult the strftime(3) documentation. Glibc notes for strftime(3): – … Read more

Formatting ToShortDateString to dd/MM/yyyy

ToShortDateString does not have an overload which takes any parameter. If your ToShortDateString() returns MM/dd/yyyy format, that means your CurrentCulture has this format in it’s ShortDatePattern property. You can always use custom formatting for that like with proper culture like; TextBox2.Text = DateTime.Today.ToString(“dd/MM/yyyy”, CultureInfo.InvariantCulture);

In C#, what is the difference between comparing two dates using tick and just as it is

Is this a more accurate way of comparing DateTime? Not in the slightest. In fact, that is how the > operator is implemented internally. From the .NET Reference source: public static bool operator >(DateTime t1, DateTime t2) { return t1.InternalTicks > t2.InternalTicks; } Someone might have thought they were being clever by skipping the one … Read more

Ordering nullable DateTime in Linq to SQL

This is a bit of a hack, but it appears to work with Linq to SQL: return from ju in context.Job_Users_Assigned where ju.UserID == user.ID orderby ju.Created ?? DateTime.MaxValue descending; So I’m substituting the maximum possible DateTime value when the actual “Create” value is null. That’ll put all the null values at the top. Another … Read more