Questions tagged [datetimeformatinfo]

29 questions
11
votes
3 answers

GetMonthName: Valid values are between 1 and 13, inclusive. Why?

I accidentally passed 0 into DateTimeFormatInfo's GetMonthName method: DateTimeFormatInfo info = new DateTimeFormatInfo(); var monthName = info.GetMonthName(0); and got a System.ArgumentOutOfRangeException with this error message: Valid values are…
Andy
  • 7,646
  • 8
  • 46
  • 69
10
votes
4 answers

DateTimeFormatInfo string format for day of week. Thursday becomes Th

Is there a DateTimeFormatInfo format pattern to convert a day of week to two characters? For example Tuesday becomes Tu, Wednesday becomes We. The format string needs to conform to the DateTimeFormatInfo for date formats. Addition: Maybe I am…
Tony_Henrich
  • 42,411
  • 75
  • 239
  • 374
9
votes
1 answer

Intl.DateTimeFormat does not output same results on different machines

we have a weird behavior of Intl.DateTimeFormat in our tests (but same in Node or chrome console). This function : Intl.DateTimeFormat('en-AU', { year: 'numeric', month: 'short', day: 'numeric' }).format(new Date()); will return month day, year…
mate2
  • 175
  • 11
6
votes
1 answer

Why does DateTimeInfo.MonthNames return a 13 member?

Possible Duplicate: GetMonthName: Valid values are between 1 and 13, inclusive. Why? The following code: DateTimeFormatInfo datetimeinfo = new CultureInfo("en-GB", false).DateTimeFormat; string[] months = datetimeinfo.MonthNames; returns 13…
Piers Karsenbarg
  • 3,105
  • 5
  • 31
  • 67
6
votes
1 answer

How can DateTimeFormatInfo.CurrentInfo be null

I have the following code in my C# application. DateTimeFormatInfo.CurrentInfo.DayNames ReSharper 7.1.1 is highlighting the fact that the DateTimeFormatInfo.CurrentInfo could cause a null reference exception. Under what circumstances would this…
6
votes
2 answers

Convert ASP.NET textbox control .text contents to Date/Time format

I am trying to insert into a database - various details about an event. The asp.net textbox is using the Calendar Extender (so a little calendar pops up and fills the textbox with a correctly formatted date). The EventDate field in my Access…
adaam
  • 3,700
  • 7
  • 27
  • 51
2
votes
3 answers

How to show only current month and previews month's dates selectable in datePickerDialog?

Show Only Current and previous month in date picker dialog. datePickerDialog = new DatePickerDialog(DateConvertActivity.this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int month, int…
Hiten B
  • 61
  • 1
  • 12
2
votes
1 answer

java parse date with picosecond

I have a string date with picoseconds (between 9 to 12 digits after the period), and when I try to parse the date with the DateTimeFormatter : DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSSSSSSS"); it throws…
2
votes
1 answer

ISO 8601 Define repeating interval on Thanksgiving?

I'm trying to define an interval that repeats every year, starting on the 4th Thursday of November at 13:30z and ending on the same day at 15:00z. Can this be done using ISO 8601?
2
votes
1 answer

AM/PM designatior special case for noon and midnight

VB2012: I am reading data from a legacy system. One of the fields is a time and I am reading that into a DateTime variable. I use the "hhmmt" format to parse out the date with DateTime.ParseExact. The only issue I have is that the legacy system…
sinDizzy
  • 1,300
  • 7
  • 28
  • 60
2
votes
1 answer

Define time intervals using day of week/month (ISO 8601?)

I want to define time intervals like: Each week, from Monday 12:00 a.m. to Sunday 11:59:59 p.m. Each day from 12:00 a.m. to 11:59:59 p.m. Each month from the first day of the month 12:00 a.m. to the last day of the month 11:59:59 p.m. Is this…
root66
  • 477
  • 5
  • 17
2
votes
0 answers

Wrong MonthDayPattern in Silverlight on PC with German Windows

I am facing a really strange issue into a PC with German Windows Server 2003 installed. It is important to mark that this doesn't happen on a PC with English Windows installed even if I set Thread.CurrentThread.CurrentCulture,…
itskoBits
  • 435
  • 4
  • 13
2
votes
2 answers

Simple Date Format for string

I have my current data as 2012-08-20T12:30:00+05:30 DateTime currentdata = "2012-08-20T12:30:00+05:30"; I am using String myDate = new SimpleDateFormat("MM/dd/yyyy").format(currentdata); I get Cannot format given Object as a Date Any clues??
Some Java Guy
  • 4,992
  • 19
  • 71
  • 108
1
vote
0 answers

get pandas dataframe column datetime format

How can we get the format of datetime column in Pandas dataframe? # This is how we set! df["Date"] = df["Date"].strftime("%m-%d-%Y") Now, how do I get it? as df['Date'].????? >>> "%m-%d-%Y"
s_mj
  • 530
  • 11
  • 28
1
vote
1 answer

Editing Date and Time in python through SQLite3

I am making a library system in tkinter and using SQLite3 as my DB. I have to take date as input from system which I can take by using "from datetime import date" but in one cell I wanna add 7 days to that particular date. Eg. if one column is…
1
2