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 8384311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:22:30+00:00 2026-06-09T17:22:30+00:00

I need to display some dates on windows phone with day and month only.

  • 0

I need to display some dates on windows phone with day and month only.

For example, January 1st, for American users I want the text to be ‘1/31′ and for UK users I want it to be ’31/1’.

What’s the easiest way to achieve something like this?

UPDATE:
My app will be available in a lot of countries. Do I have to specify each culture to get what I want?

For example,

de-DE Culture                         01.10
en-US Culture                         10/1
es-ES Culture                         01/10
fr-FR Culture                         01/10

The left column contains some countries my app will support, the right column is how I want my date text to be.

Is there any generic way I can achieve this?

  • 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-06-09T17:22:31+00:00Added an answer on June 9, 2026 at 5:22 pm

    Wow, that question is particularly interesting! I didn’t found some obvious solution, so here it goes:

        char[] trimmer = DateTimeFormatInfo.CurrentInfo.DateSeparator.ToCharArray();
        string dateStr = date.ToString("d").Replace(date.ToString("yyyy"), string.Empty).Trim(trimmer);
    

    If you can’t use DateTimeFormatInfo, then following code should do the trick:

    string tmp = date.ToString("d").Replace(date.ToString("yyyy"), string.Empty);
    char last = tmp[tmp.Length - 1];
    char[] trimmer = char.IsDigit(last) ? new char[] { tmp[0] } : new char[] { last };
    string dateStr = tmp.Trim(trimmer);
    

    As @ken2k correctly mentioned, this solution is also flawed (and much more than I actually expected). Here is the complere test suite (compile as console application):

    using System;
    using System.Diagnostics;
    using System.Globalization;
    
    class Program
    {
        static void Main(string[] args)
        {
            CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
    
            DateTime date = DateTime.Now;
    
            foreach (CultureInfo culture in cultures)
            {
                string tmp = date.ToString("d", culture).Replace(date.ToString("yyyy", culture), string.Empty);
                char last = tmp[tmp.Length - 1];
                char[] trimmer = char.IsDigit(last) ? new char[] { tmp[0] } : new char[] { last };
                string dateStr = tmp.Trim(trimmer);
    
                Console.WriteLine(string.Format("{0,12}, {1,15} => {2,10}", culture.IetfLanguageTag, date.ToString("d", culture), dateStr));
            }
    
            if (Debugger.IsAttached)
            {
                Console.WriteLine();
                Console.WriteLine("Press any key to exit..");
                Console.ReadKey();
            }
        }
    }
    

    Further optimization is possible (at least in full framework), however it’s becoming rather complex (limited framework of a Windows Phone adds complexity also) and it’s not clear if such date representation will make sense in some cultures. For example in some cultures date part separator is a two-char sequence:

    hu-HU, 2012. 08. 14. => 08. 14

    does 08. 14 actually look good? Or should it be 08. 14.? I’m not sure. If I were you, and I really want to handle maximum amount of cultures, I would just stick with standard “d” format specifier.

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

Sidebar

Related Questions

Ok, So I want to display some attributes, but only if they have a
I need to display some Gui to the user with c++ on Mac OS
I need to display some analytics to the user; however, occasionally these analytics can
I am displaying a form with Symfony2 and Twig, and need to display some
Need some help assigning a mouseover event to display some icons that start out
I need your help with display of some comma separated enteries from my database.
At some point I need to display a disabled (greyed out by disabled=disabled attribute)
I need to display to the screen some values which are read in method
I have some text that I always need to display (like a HUD). When
I have a RichTextBox and I add some texts programatically. I need to display

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.