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

  • Home
  • SEARCH
  • 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 86795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:18:08+00:00 2026-05-10T22:18:08+00:00

Not sure what’s going on here. I have a DateTime object, and when I

  • 0

Not sure what’s going on here.

I have a DateTime object, and when I try:

String.Format( '{0:dd/MM/yyyy}', _date) 

the value returned is:

'24-05-1967' 

What I want is

'24/05/1967' 

Can anyone explain why my format string is being ignored?

A bit more background: This is a web app which started out life as .net 1.1, and I’m in the process of moving it up to 2.0/3.5.

Update:

If I change the format to {0:dd:MM:yyyy}, it returns 24:05:1967 – it’s only the / in the format string that gets changed to the – char.


Resolution:

When updating the app to run under 2.0, the asp.net globalization settings were messed up.

From the web site properties, ASP.NET tab, Edit Configuration, Application Tab – the culture and UI Culture were both set to the first item in the list (af-ZA) for some bizarre reason.

  • 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. 2026-05-10T22:18:08+00:00Added an answer on May 10, 2026 at 10:18 pm

    The / is actually the date separator for your specific culture which could be -, in other words, the format string is not ignored but actually used correctly. Look at what CultureInfo is associated with the running thread:

    System.Threading.Thread.CurrentThread.CurrentCulture 

    If you try this:

    String.Format(new CultureInfo('en-US'), '{0:dd/MM/yyyy}', DateTime.Now); 

    You will get the date formatted with / since that is the correct separator for en-US. What you probably should do is use the short date format string and make sure that the thread has the appropriate culture associated, then this would get you what you want and it will work in a globalized application as well:

    DateTime.Now.ToString('d', Thread.CurrentThread.CurrentCulture); 

    Hope this helps!

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

Sidebar

Ask A Question

Stats

  • Questions 68k
  • Answers 68k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer All you have to do is create a new instance… May 11, 2026 at 12:09 pm
  • added an answer I would do this. You bind your 'visibility' function to… May 11, 2026 at 12:09 pm
  • added an answer Maybe something like this: $curRow[1]/@*[ name() = $curCol/@id ] May 11, 2026 at 12:09 pm

Related Questions

Not sure what exactly is going on here, but seems like in .NET 1.1
Not sure what's going on here. I have a DateTime object, and when I
I'm not sure what VS setting I've changed or if it's a web.config setting
I'm not sure what the best api for simple 2d graphics with Java is.
I'm not sure what this practice is actually called, so perhaps someone can edit
I am not sure what optparse 's metavar parameter is used for. I see
I am not sure what the problem is but I keep receiving this error
I'm not sure what they call the fake shortcuts you often see in Windows
I am pretty sure this is possible just not sure what is the term
I've heard people referring to this table and was not sure what it was

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.