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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:48:49+00:00 2026-05-23T14:48:49+00:00

I am working on a project and i am not having any database. I

  • 0

I am working on a project and i am not having any database. I am using Dataset of ADO.Net and then to store my data i write the xml file and read xml file and load the dataset again. The xml file is the project file and i have to move this file from system to system.

In this data set, there also a column of DateTime.

I want to store Date in field in a specific format ( dd/MM/yyyy ).

Currently, my problem is that, it detects the system’s date format and read the date. But system’s date format can vary system to system. Some people use MM/dd/yyyy and some use dd/MM/yyyy. So, when the format is changed, it throws the exceptions. Is their any solution for it?

Can i force DataTime field of data table to accept date in my custom format?

Thanks in advance.

  • 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-23T14:48:50+00:00Added an answer on May 23, 2026 at 2:48 pm

    I’ve had similar issues with serializing date time in the past.

    I’d recommend that you drop your datetime field and use a string instead. That way you have full control over what format the date time object is entered into your DataSet.

    Once you have it entered in as a string, you need to record what culture and what format the datetime is recorded in. You can either hard code those two values inside your software and hope they don’t change (not ideal). Drop those to a .config file (better).

    or

    You add those additional fields to your dataset.

    MyDateField   - DateTime as a string
    Format.       - "dd/MM/yyyy HH:mm:ss" (for example)
    Culture       - "EN-US" 
    

    So when you read your date from your DataSet to instantiate a DateTime object you then use.

    var dateTime = DateTime.ParseExact([mydatefield], [format], new cultureInfo([culture]));
    

    *Note that fields inside [] are values retrieved from a row in the dataset.

    This way you can use this datetime field on any machine as you are specifying in the dataset what culture and format provider to use.

    You will need to refactor everywhere you are instanciating a datetime field from the dataset to use those datetime provider and culture information.

    Personally, I’d go with reading the format and culture information from a .config file as these are not likely to change on a row by row basis in your dataset.

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

Sidebar

Related Questions

The project I'm working is using n-tier architecture. Our layers are as follows: Data
I'm currently having the following issue in my project: I'm using Core Data to
I'm working on a project involving the .NET ReportViewer, and I'm having issues connecting
I am working a project that does not have a trunk / branches /
I'm working on a project which I'm really not sure how to unit test.
Suppose you're working on a project and the time/money budget does not allow 100%
I recently was working with a subversion project that checked out code not only
I'm working on a security project in Javascript (something I honestly have not used),
I'm working on a web app project (in java; not that it matters) and
I'm working on a fairly new project and we started from scratch. So not

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.