Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 471483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:59:26+00:00 2026-05-12T23:59:26+00:00

Is there any way in .Net I can get the default format used by

  • 0

Is there any way in .Net I can get the default format used by DateTime.ToString() to change from ToString(“G”) to ToString(“o”)?

I don’t have the option of using a different overload it has to be ToString().

Update:
I found a way to do what I need using DateTimeOffset but it was very useful to see Gonzalo’s solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:59:26+00:00Added an answer on May 12, 2026 at 11:59 pm

    This is the closest I could get. The only problem is that there’s a space between the date and the T:

    using System;
    using System.Threading;
    using System.Globalization;
    
    class Test {
        static void Main ()
        {
            Console.WriteLine (DateTime.Now.ToString ("o"));
            CultureInfo culture = (CultureInfo) CultureInfo.CurrentCulture.Clone();
            culture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
            culture.DateTimeFormat.LongTimePattern = "THH:mm:ss.fffffffzzz";
            Thread.CurrentThread.CurrentCulture = culture;
            Console.WriteLine (DateTime.Now);
        }
    }
    

    The output was:

    2009-11-23T00:32:53.5291030-05:00
    2009-11-23 T00:32:53.6493060-05:00

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there any way to get the ASP.NET validation summary control to just display
Is there any way to access my asp.net dev server (launched from visual studio)
Is there any way to read the asp.net Import directives at runtime? I have
Is there any way to capture the MouseDown even from the .NET 2.0 TextBox
Is there any way that I can get visual studio (2010 or other) to
Is there a simple way to change the default colors of controls in asp.net
Is there any way in VB.NET to remove all of the whitespaces between tags
Does there exist any way in .Net to check before opening if a file
Is there any way to render ASP.net MVC controls or code directly within a
Is there any way to run the .NET exe (of a winform app) in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.