Fix the DateTime Parsing Error for ’23/07/2025′
The error usually occurs because 23/07/2025 is a day/month/year date, but the parser expects a different format, commonly month/day/year. In C#, fix it by parsing explicitly with dd/MM/yyyy rather than relying on the machine’s regional settings. The steps below show a safe .NET fix, followed by checks for mixed-format imports, event-creation workflows, and application errors.
Use the symptom to identify where the conversion is going wrong:
| Symptom | Likely Cause | Fix |
|---|---|---|
| A day-first date is rejected | The parser treats the first component as the month | Specify the input format explicitly |
| Parsing works locally but fails on a server | The environments use different cultures | Supply both the format and culture at the conversion point |
| Only certain records fail | Mixed formats, extra characters, or impossible dates | Inspect the raw values and validate before processing |
| Parsing succeeds, but the saved date is wrong | An ambiguous date was interpreted in the wrong order | Use a declared source format instead of guessing |
| An event-creation action rejects the date | The destination expects a timestamp, not a display date | Construct the date-time and time-zone fields required by that connector |
Why This Date Triggers a FormatException
The input represents July 23, 2025, a valid calendar date. However, a month-first parser attempts to interpret its first component as the month, which cannot work.
In .NET, this commonly happens when code uses DateTime.Parse or Convert.ToDateTime without specifying a culture. Those calls can depend on the current culture of the executing thread. A development machine and a production service may therefore interpret identical text differently.
An exact parser can also fail: DateTime.ParseExact throws a FormatException when the input does not match its supplied pattern.
There are two separate operations to keep straight:
- Parsing converts text into a date value.
- Formatting converts a date value into text.
Changing how a date is displayed does not fix how its input is parsed.
Calling ToString with a different output format cannot repair a conversion that already failed. The fix belongs where the original string first becomes a date.
How to Fix the DateTime Parsing Error
Step 1: Inspect the Actual Input and Its Expected Format
- Find the conversion that fails using the exception’s stack trace or the failed workflow action.
- Inspect the raw value immediately before that conversion. Check for surrounding whitespace, an appended time, unexpected separators, or a missing value.
- Confirm the source field’s date convention and the format expected by the parser.
For this input, the common .NET day-first pattern is dd/MM/yyyy: a two-digit day, a two-digit month, and a four-digit year. Confirm that order in the source’s field definition, import specification, or application culture, not merely from how your computer displays dates.
.NET format tokens are case-sensitive. Uppercase MM means month; lowercase mm means minutes.
If the existing code relies on culture, inspect CultureInfo.CurrentCulture.Name in the failing environment. Treat that as diagnostic information, not as a reason to change the entire server’s regional settings.
Step 2: Parse Explicitly With TryParseExact
- Replace the culture-dependent conversion with an explicit parser.
- Handle a failed conversion before using the result.
This complete C# console example accepts the supplied date without depending on the machine’s culture:
using System;
using System.Globalization;
public static class Program
{
public static void Main()
{
string input = "23/07/2025";
if (!DateTime.TryParseExact(
input,
"dd/MM/yyyy",
CultureInfo.InvariantCulture,
DateTimeStyles.None,
out DateTime date))
{
Console.Error.WriteLine(
"Invalid date. Expected day/month/year.");
return;
}
Console.WriteLine(
date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
}
}
The expected output is:
2025-07-23
The explicit pattern establishes the component order. CultureInfo.InvariantCulture keeps culture-sensitive parts of that pattern consistent across environments; using invariant culture alone would not select a day-first input format.
TryParseExact returns false when the input does not match or represents an impossible date. That lets an application return a validation message instead of throwing an exception for ordinary bad input.
- Run the example, then apply the conversion at your application’s input boundary.
- Make the failure branch return a validation error, flag the import row, or stop the affected operation. Do not continue using the output variable after parsing fails.
ParseExact is also suitable when malformed input should raise an exception. For user-entered values and imported records, TryParseExact generally makes validation easier to handle.
Step 3: Keep the Parsed Date Typed
- Pass the resulting
DateTimeinto application logic rather than converting it back to a localized string and parsing it again. - When writing to a database, use a typed parameter appropriate for the destination column.
- When sending text to another system, serialize according to that system’s documented contract. Reserve localized formatting for display.
- Retry the original operation and inspect the saved or returned date, not just the absence of an exception.
For example, a successful import should store the intended calendar date. A successful HTTP response is not enough if a later conversion silently changes its interpretation.
Avoid “fixing” the input by swapping components or replacing slashes with hyphens. Punctuation changes do not establish which component is the day, month, or year.
Handle Ambiguous Dates and Mixed Inputs
Use an intentional user culture for free-form entries, and require a declared date convention for mixed-format imports.
Human-Entered Dates
For free-form dates entered by users, DateTime.TryParse with an explicitly selected user culture can be appropriate. That is a different contract from an import field that promises one exact format.
The important requirement is that the culture comes from an intentional application choice, not whichever locale the server happens to use. If parsing fails, keep the user’s input and present a clear validation message.
Before saving, display the interpreted date in a way the user can confirm: for example, with the month written out. This helps catch valid-looking but incorrectly interpreted dates.
Mixed-Format Imports
An input such as 05/06/2025 can mean May 6 or June 5. Both are valid, so the absence of an exception does not prove the interpretation is correct.
A parser cannot recover a date convention that the source never specified.
For imports that accept more than one format:
- Associate each file or source with a declared date convention.
- Allow only formats that the import contract supports.
- Require clarification when an input is ambiguous.
- Keep rejected rows available for correction rather than silently substituting a default date.
Trying a day-first parser and then a month-first parser is not a reliable way to infer intent. An ambiguous value may succeed under the first pattern even when the source intended the second.
After defining the import contract, test a value that could be interpreted both ways and confirm that the stored result matches the declared source convention.
Whitespace and Extra Characters
Inspect the original value before normalizing it. A field that appears to contain only a date may also contain a time, a nonbreaking space, or another unexpected character.
If the field contract permits surrounding whitespace, trim it intentionally before parsing and test that behavior. If the contract is strict, reject the value with a useful message instead.
Do not strip arbitrary characters until parsing succeeds. That can turn malformed data into a different, apparently valid value.
Fix Date-Time Values in APIs and Automations
Confirm each source convention, then submit date-time values in the receiving system’s accepted format with the required time-zone information.
Nonstandard Timestamps
The string 09-10-2025t20:53z has a different problem from a slash-separated date: its component order is not the conventional year-first ISO 8601 order, and the intended month is ambiguous.
If the source means October 9, 2025, at 20:53 UTC, a conventional ISO 8601 representation is:
2025-10-09T20:53:00Z
If the source means September 10 instead, the month and day must reflect that interpretation. Confirm the source convention before converting it.
Uppercase T separates the date and time in this representation, and Z denotes UTC. Changing the letter case alone does not resolve an incorrect or ambiguous date order.
Once the source meaning is known, serialize it in the receiving system’s accepted format and verify the resulting date and instant. “ISO 8601” describes a family of representations; an individual API may accept only a particular subset.
Create_Event Failures
When an action named create_event fails, inspect the actual start and end values sent by the action, not just the date displayed in the workflow editor.
For a timed event:
- Parse the source date using its declared convention.
- Combine it with the intended start and end times.
- Supply time-zone information as the connector requires.
- Submit the action again and inspect the resulting calendar entry’s day, start time, and end time.
Some connectors accept timestamps containing an offset. Others require local date-time values and a separate time-zone field. Use the connector’s actual input contract rather than assuming that a display date is sufficient.
Do not append Z to a local time to make it look acceptable. That asserts the value is already UTC; it does not convert the time to UTC.
In .NET, DateTimeOffset is useful when a value must retain its UTC offset. A date-only input contains no time-zone information, so parsing it cannot establish a UTC instant.
For an all-day event, use the connector’s all-day date fields or documented convention. Do not invent a midnight UTC timestamp unless that is what the destination explicitly requires.
Verify the Fix and Prevent Locale Regressions
Test the conversion as an input-validation boundary, not just as a single successful example.
Your checks should include:
- The original failing input: It produces the intended calendar date.
- An impossible date: A value such as
31/02/2025is rejected. - An ambiguous date: Its interpretation follows the declared source convention.
- Null and empty input: The application returns a controlled validation result rather than using a default date.
- Unexpected whitespace: The application either normalizes it deliberately or rejects it consistently.
- Different cultures: Exact-format input produces the same result under month-first and day-first runtime cultures.
- A round trip: Saving and retrieving the value preserves the intended date.
For a service or containerized application, run these checks in the deployed runtime as well as locally. Culture-dependent behavior can remain hidden when every developer uses the same regional settings.
Avoid changing a server-wide culture to repair one field. That can also affect number, currency, and other date conversions elsewhere in the application.
Keep the source format in the field’s documentation and cover it with automated tests. Then rerun the original request in the environment that failed and verify the persisted result.
Frequently Asked Questions
What Does This Error Mean in GoAnywhere Secure Mail?
A DateTime parsing error in GoAnywhere Secure Mail means a date conversion failed during the operation, but the message alone does not identify a GoAnywhere-specific defect. Capture the complete error, the operation that triggered it, and any date value supplied by a form or integration. If an editable date is involved, enter it in the format expected by that field and retry; otherwise, give the application administrator or support team the version and relevant logs, with sensitive information removed.
How Do I Fix This Error in a Bluebeam Project?
If an editable date is involved, correct it through Bluebeam’s supported input controls and retry the failed operation. If there is no date input to correct, record whether the failure occurs while opening, importing, editing, or synchronizing, and preserve a copy of the affected file before making changes. Provide the complete error and application version to the administrator or support team rather than rewriting project metadata or changing system-wide regional settings blindly.
Is This the Same as “Input String Was Not in a Correct Format”?
“Input string was not in a correct format” is a broader conversion error and does not necessarily involve a date. It can also occur when parsing a number or another structured value. Identify the failing conversion in the stack trace and validate against that type’s expected input; a date-format change will not repair a numeric parsing failure.
Why does a System.FormatException say that a string is not a valid DateTime?
A System.FormatException for an invalid DateTime means the date text does not match a representation that the conversion can interpret. Default DateTime.Parse and Convert.ToDateTime behavior uses the current culture, so a value can fail when its source format differs from that setting. Identify the source date pattern and parse it with a matching explicit format instead of guessing the component order.
