UK DateFormat

Posted on 2006-06-29
Last Modified: 2010-04-16

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
Question by:ziwez0

Accepted Solution

e1v earned 500 total points
ID: 17008508
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

Expert Comment

ID: 17008574
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

Author Comment

ID: 17009010
e1v that did the job, (MM/dd/yyyy) so does that mean the db is setup in US Format?

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now