Hi i want to convert an integer value into datetime(mmm-yyyy) format can u help?
example: i have integer value :6 now i want to convert this 6 into Jun-2013 How can i convert.
example: i have integer value :6 now i want to convert this 6 into Jun-2013 How can i convert.
Anandu G NathPosted Dec 28, 2023, 7:11 AM
@deepa ashwi check this code
Ifour HirenPosted Nov 3, 2016, 5:15 AM
String.Format("{0:M MM MMM MMMM}", dt); // "3 03 Mar March" month
String.Format("{0:d dd ddd dddd}", dt); // "9 09 Sun Sunday" day
String.Format("{0:h hh H HH}", dt); // "4 04 16 16" hour 12/24
String.Format("{0:m mm}", dt); // "5 05" minute
String.Format("{0:s ss}", dt); // "7 07" second
String.Format("{0:f ff fff ffff}", dt); // "1 12 123 1230" sec.fraction
String.Format("{0:F FF FFF FFFF}", dt); // "1 12 123 123" without zeroes
String.Format("{0:t tt}", dt); // "P PM" A.M. or P.M.
String.Format("{0:z zz zzz}", dt); // "-6 -06 -06:00" time zone
Standard Formating Of Date
String.Format("{0:t}", dt); // "4:05 PM" ShortTime
String.Format("{0:d}", dt); // "3/9/2008" ShortDate
String.Format("{0:T}", dt); // "4:05:07 PM" LongTime
String.Format("{0:D}", dt); // "Sunday, March 09, 2008" LongDate
String.Format("{0:f}", dt); // "Sunday, March 09, 2008 4:05 PM" LongDate+ShortTime
String.Format("{0:F}", dt); // "Sunday, March 09, 2008 4:05:07 PM" FullDateTime
String.Format("{0:g}", dt); // "3/9/2008 4:05 PM" ShortDate+ShortTime
String.Format("{0:G}", dt); // "3/9/2008 4:05:07 PM" ShortDate+LongTime
String.Format("{0:m}", dt); // "March 09" MonthDay
String.Format("{0:y}", dt); // "March, 2008" YearMonth
String.Format("{0:r}", dt); // "Sun, 09 Mar 2008 16:05:07 GMT" RFC1123
String.Format("{0:s}", dt); // "2008-03-09T16:05:07" SortableDateTime
String.Format("{0:u}", dt); // "2008-03-09 16:05:07Z" UniversalSortableDateTime
Jignesh TrivediPosted Jul 16, 2013, 11:02 PM
hi,
if your are looking in c# than try
string dtName = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(6) + " - " + DateTime.Now.Year.ToString();
or if you are looking in SQL
DECLARE @monthName INT =6
Select DateName(month ,DateAdd( month ,@monthName,0 )- 1) + ' - ' + CAST(YEAR(getdate()) AS VARCHAR)
hope this will help you.
Syed ShanuPosted Jul 16, 2013, 6:18 PM
Riyaz AkhtarPosted Jul 16, 2013, 2:58 AM
Sanjeeb LenkaPosted Jul 16, 2013, 2:58 AM
try like this
using System.Globalization;
string strMonthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(8);
pass the number to get it as text.
if you want current year concat it with month.
like this
DateTime dt = new DateTime(2013, 6, DateTime.Now.Day);
string date = dt.ToString("MMM-yyyy");