Question:
Asp.net Problem: Date Format : I need british date format.?
ashkan654
2006-03-26 00:46:46 UTC
How I can adjust my asp page to showing date on British Format
dd-mm-yyyy
Eight answers:
anonymous
2006-03-26 01:35:11 UTC
Try setting the LCID to 2057, the British code.



<%session.lcid=2057%>



This should work for asp.net and only needs one line to function. Works for the currency markers and everything else that is region specific.



(It seems alot of people have been asking where to use this code. I found it works when entered anywhere above where you want to utilise any date procedures/output. Personally I always put it as the second line in my init file, after the language declaration)
anonymous
2016-05-20 09:34:28 UTC
If you put 12/22/09 and format it as a date you have several ways for excel to show the date. Basically all excel sees is your entry the format is only a view, you can format it to say December, 22, 2009. If you want to know what excel sees and uses look at the bar on the top when your on that cell no matter how it's formatted. When you sort it will sort using the numbers you typed and excel sorts by month, then day then year either forward or backward. If you enter the year first it gets confused. If you put a ' it thinks it text and won't format it as a date or a number.
anonymous
2006-03-26 10:45:29 UTC




For dates on a datagrid, you could use a data format string, for a simple uk date you could use dd/mm/yy



dddd would give you the day name

ddd would be short hand day

dd would be the number in the day



the same as month.



of you could do it with string manipulation functions in the code. looking at the string manipulation http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=169&lngWId=10
IraqiHaider
2006-03-26 00:53:12 UTC
Use format function
anonymous
2006-03-26 01:50:38 UTC
http://www.pbdr.com/vbtips/asp/dateforma...
David S
2006-03-26 00:50:18 UTC
http://www.pbdr.com/vbtips/asp/dateformat.htm shows an example of what you need.
James Bond
2006-03-26 00:59:34 UTC
you must try this..go to control panel,

->select Regional and language option.

->select your country for your format,

->select customize

->and lastly select date tab..set your format there..

gud luck!
DJValy
2006-03-26 00:51:47 UTC
David S: he asked ASP.NET :))



private void DateSubmit_Click(object sender, System.EventArgs e)

{

DateTime date1, date2;

bool date1OK, date2OK;

date1 = new DateTime(1,1,1);

date2 = new DateTime(1,1,1);

try

{

date1 = Convert.ToDateTime(Date1.Text);

date1OK=true;

}

catch

{

date1OK = false;

}

try

{

date2 = Convert.ToDateTime(Date2.Text);

date2OK=true;

}

catch

{

date2OK = false;

}

if(date1OK && date2OK)

{

if(date1.CompareTo(date2) > -1)lblResult.Text = "Date2 must be after Date1";

else

{

//do whatever here

}

}

else lblResult.Text = "Invalid date format. Please check your input in the Date1 and Date2 fields";

}


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...