
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Year Month ("Y") Format Specifier in C#
The Year Month format specifier represents a custom date and time format string.
It is defined by the DateTimeFormatInfo.YearMonthPattern property.
Here is the custom format string.
yyyy MMMM
Example
using System; using System.Globalization; class Demo { static void Main() { DateTime date = new DateTime(2018, 9, 7, 7, 55, 20); Console.WriteLine(date.ToString("Y",CultureInfo.CreateSpecificCulture("en-US"))); } }
Output
September 2018
Advertisements