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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:37:26+00:00 2026-05-24T12:37:26+00:00

I have been writing a WP7 app and part of the functionality involves the

  • 0

I have been writing a WP7 app and part of the functionality involves the use of a DateTime value. This value is also stored (in a Sterling database).

I have tried to steer away from different culture values in the dates and where I need to present it I do so using my own format out. I never ‘fiddle’ with DateTime as such.

All works fine with the emulator, on a PC which is setup running the English (New Zealand Locale)

But on the phone itself, things were being screwed up as the the day and month were being screwed up. Have now realised that the locale on the phone was English (United States) but the region format was English (New Zealand). Have changed both to be English (United States) and all is fine on the phone.

So my question(s) are

1/ should I need to allow for differing locales and regions

2/ Is there an easy way to ensure that this issue does not occur?

My code is as follows

A property defined as follows

 public const string NextDateTimePropertyName = "NextDateTime";
    private DateTime _nextDateTime;
    public DateTime NextDateTime
    {
        get
        {
            return _nextDateTime;
        }
        set
        {
            if (_nextDateTime != value)
            {

                _nextDateTime = value;
                RaisePropertyChanged(NextDateTimePropertyName);

            }
        }

    }

A binding to display the date as follows
TextBlock Text=”{Binding DateTimeDayString}”

and a property on my class hat maps to the binding

 public string DateTimeDayString
    {

        get
        {
            return NextDateTime.ToString("dddd MMM d");
        }

    }

When the Phone locale and region are the same country everything works fine, however when the Locale and region are different i.e. Locale English – UK and English – US then the
9th August as entered would display as the “Thursday, 8th September”

I realise that having a differing locale and region is an unusual setup.. but was looking to see how I could protect myself against this.

Date is being selected via a DatePicker control

x:Name="datePicker"  Value="{Binding EventDate, Mode=TwoWay, UpdateSourceTrigger=Explicit}"
                 ValueChanged="datePicker_ValueChanged" ValueStringFormat="{}{0:D}"   Margin="22,87,91,0" 

with a property in the view model as follows

 private DateTime _EventDateTime;
    public DateTime EventDateTime
    {

        get
        {
            return _EventDateTime;
        }

        set
        {
            if (value != null)
            {
                _EventDateTime = value;

            }


        }


    }

And when I store this property

CurrSingleEventItem.NextDateTime = EventDate.BuildDateTime(EventTime);

And the BuildDateTime Extension method (because I am having the user enter the time via a timepicker as well

 public static DateTime BuildDateTime(this String DateString, String time)
    {


        DateTime dt = System.Convert.ToDateTime(DateString);
        DateTime timedt = System.Convert.ToDateTime(time);
        string timestr = timedt.ToString("H:mm");
        DateTime newDt = System.Convert.ToDateTime(dt.ToLongDateString() + " "  + timestr + ":00");
        return newDt;

    }
  • thanks – Peter
  • 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-24T12:37:27+00:00Added an answer on May 24, 2026 at 12:37 pm

    You haven’t really said what was wrong – “the day and month were being screwed up” isn’t very precise. If the region format was set to New Zealand and you were seeing dates formatted as dd/MM/yyyy, that seems entirely reasonably to me – it’s what someone from New Zealand (or the UK, or most places other than the US…) would probably expect.

    As for whether you need to allow for different locales and regions – that’s entirely your business. Are you expecting the app to be used in multiple countries? If so, then you absolutely should be culture-sensitive.

    As for your second question: it’s not at all clear that there was an “issue” in the first place. If the date was simply formatted in a New Zealand style, I don’t see that as an issue. If you ended up with corrupt data somehow, that’s a different matter – and one you need to give far more details of.

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

Sidebar

Related Questions

I have been writing DLL on C++, that will be use in C#. DLL
I have been experimenting with writing applications that use a local SQL Database to
I have been writing this Android application for the past few days and everything
I have been writing this encryption algorithm in my free time for a few
I have been writing some code with basically this structure namespace util { void
I have been writing a user-defined function in SQL Server: It looks like this
I have been writing a C# app that works fine on Windows. It controls
I have been writing objective c for couple of weeks. However this question still
I have been writing C++ Console/CMD-line applications for about a year now and would
I have been writing unit tests using NUnit and Moq with my Silverlight code

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.