Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

UK DateFormat

it seems no matter what I try I cannot return correct date values from my select statement, fo example I have a calender
control which the user selects the date then click a button to run

string startdate = string.Format("#{0:dd/MM/yyyy}#", Calendar1.SelectedDate);
select....WHERE ([dbx].[Arrival Date]= " + startdate + ")";

so i select 01/07/06 but returns 07/01/06
1 Solution
You must either change your startdate string to MM/dd/yyyy or change the dateformat on the database with
set dateformat dmy
before the select
I am getting it in the correct it in the correct format. I tried the same code that you have specified. I dont think you have any problem with your SelectedDate statement.

Anandavally P
ziwez0Author Commented:
e1v that did the job, (MM/dd/yyyy) so does that mean the db is setup in US Format?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now