Share via

Date in different format

ankit goel 766 Reputation points
2023-09-29T11:52:18.3633333+00:00

Hi ,

i am creating a textbox which can display the date , in which the month is in short format . like
sept , oct . Any suggestions for that

Developer technologies | Windows Forms
Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Answer accepted by question author

KOZ6.0 6,810 Reputation points
2023-09-29T12:13:01.04+00:00

I suggest ComboBox.

var info = new System.Globalization.CultureInfo("en-us");
var months = Enumerable.Range(1, 12)
                .Select(i => new DateTime(1, i, 1)
                .ToString("MMM", info)).ToArray();
comboBox1.Items.Clear();
comboBox1.Items.AddRange(months);

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.