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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:02:29+00:00 2026-06-06T15:02:29+00:00

my c# program selects a datetime field from database and returns the data like

  • 0

my c# program selects a datetime field from database and returns the data like the following:

21/06/2012 4:11:48 p.m.

it is not stored this way though (it’s stored like 2012/06/21 15:19:10:000).
my locale is set to English/New Zealand

but when I try to save it back to database

the ISDATE() sql function doesn’t like that format and just returns NULL. Do I have any options to set the time format in sql or c#? What in sql or c# is making it put “p.m.”? (instead of just “PM”, which by the way works)

Summing up the problem

See latest related link

  • 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-06T15:02:31+00:00Added an answer on June 6, 2026 at 3:02 pm

    You shouldn’t be saving it in the database as text at all – you should be using the relevant data type such as DATETIME, and passing DateTime values from .NET to the database using SQL parameters. If you’re using the right data type, the value won’t actually be stored as “2012/06/21 15:19:10:000” at all. That may be how you see it in SQL Server Studio or something similar, but that doesn’t mean it’s the raw storage format.

    Logically, a date/time doesn’t have a format any more than the number ten is “10” (decimal) vs “A” (hex). Avoid string conversions as far as you can, and your life will be easier.

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

Sidebar

Related Questions

My ProgressDialog will not show up. In my program the user selects bitrate from
Write a program that randomly selects from a bag of eight objects. Each object
I have the following stored procedure to retrieve a new datetime: CREATE PROCEDURE [dbo].[GetTransactionTime]
I have a program in which a user selects a row in a Datagrid
I'm working on a picture select/crop program and using this code below: http://www.androidworks.com/crop_large_photos_with_android/comment-page-1#comment-969 As
I have written a query in Sql server 2008. select select * from program
I want to ability to select code from my program such as dreamweaver or
I have a function that returns me only the fridays from a range of
Why this approach don't seem to work? What should be the standard approach? [Database(Name
I'm having a difficult time trying to load System.Data.SQLite.dll from PowerShell in Windows 7

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.