ASP.NET - how to conver datetime (mm//dd//yyyy) to (dd//mm//yyyy) in ASP.Net using C#

Asked By arish chaithanya
09-Feb-10 06:45 AM
i want to convert Date from (mm//dd//yyyy) in asp.net application to (dd//mm//yyyy) .

please help me out with this


Regards,
Chaitan
  Huggy Bear replied to arish chaithanya
09-Feb-10 06:57 AM
string mmddyyyy = "12/28/2009";
string ddmmyyyy = Convert.ToDateTime(mmddyyyy).ToString("dd/MM/yyyy")


Also slash should be single and not double.
  Sakshi a replied to arish chaithanya
09-Feb-10 07:00 AM

You can also do like this,

DateTime dt;

dt.CustomFormat = "mm/dd/yyyy HH:mm:ss";

  Lalit M. replied to arish chaithanya
09-Feb-10 07:09 AM
show this
http://p2p.wrox.com/general-net/27350-convert-mm-dd-yyyy-dd-mm-yyyy.html
  Sandra Jain replied to arish chaithanya
09-Feb-10 07:36 AM
I tried using this piece of code:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dt As DateTime
        dt = "2/13/2009"
        Dim str As String = dt.Day & "/" & dt.Month & "/" & dt.Year
        MsgBox(str)
    End Sub

Output

13/2/2009
Create New Account
help
Net hi friends Any one send frequently asked Important questions in C# .Net, ADO .Net, Asp .Net and Sql Server. . . . . . . . tx in Advance. . . . . . Hi, Find this. . (B)What is an IL? (B A) What is scavenging? (B) What are different types of caching using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are
Exception ex) { if (SiteUrl ! = "" ) { ddlSite.Items.Add(SiteUrl); } else { ddlSite.Items.Add( "http: / / soliverasia.biz / " ); } Page.Response.Write(ex.ToString()); } / / Page.Response.Write("<div id = 'mydiv' > "); / / Page.Response.Write("_"); / / Page.Response.Write("< / div> "); / / Page.Response.Write("<script> mydiv.innerText = '';< / script> "); / / Page.Response.Write("<script language = javascript Page.Response.Write("var dots = 0;var dotmax = 10;function ShowWait()"); / / Page.Response.Write("{var output; output = 'Loading';dots++;if(dots> = dotmax)dots = 1;"); / / Page.Response.Write
I have the following code in the presentation, under the save button : bk.DateStarted = Convert.ToDateTime(txtDateStarted.Text); bk.EmpId = lblID.Text; bk.Employer = Convert.ToInt16(txtEmployer.Text); bk.EmpName = txtEmpName the DataAccess : public void AddEmp(string EmpId, string EmpName, string JobTitle, string EmploymentStatus, int Employer, DateTime DateStarted) { string sql = "INSERT INTO EmploymentDetails (EmpId, EmpName, JobTitle, EmploymentStatus, Employer, DateStarted) VALUES(@EmpId, @EmpName String), MakeParameter("@EmploymentStatus", EmploymentStatus, DbType.String), MakeParameter("@Employer", Employer, DbType.Int16), MakeParameter("@DateStarted", DateStarted, DbType.DateTime) }; RunNonQuery(sql, paramBlog); } public void UpdateEmp( string EmpName, string JobTitle, string EmploymentStatus, int Employer, DateTime DateStarted) { string sql = "UPDATE EmploymentDetails SET EmpName = @EmpName, JobTitle = @JobTitle, EmploymentStatus = @IEmploymentStatus, Employer = @Employer, DateStarted String), MakeParameter("@EmploymentStatus", EmploymentStatus, DbType.String), MakeParameter("@Employer", Employer, DbType.Int16), MakeParameter("@DateStarted", DateStarted, DbType.DateTime), }; RunNonQuery(sql, paramBlog); } Hi, This problem may occur when the following conditions are true: • The value in your selectedvalue property which generates a primrykey constraint in your data. In this asp.net tutorial you will learn how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it
server. . . can any one help me with the code. . . using c#. . Hi, Here is a page using the calendar extender. I've placed a dropdownlist control and a html select below calendar it appears to render over top when I use IE 7 or FireFox 2. <%@ Page Language = "C#" AutoEventWireup = "true" CodeFile = "Default.aspx.cs" Inherits = "_Default" %> <!DOCTYPE html PUBLIC "- / / W3C / / DTD xhtml11.dtd"> < html xmlns = " http: / / www.w3.org / 1999 / xhtml " > < head runat = "server" > < title > Untitled Page< / title > < / head > < body > < form id = "form1" runat = "server" > < asp:ScriptManager ID = "ScriptManager1" runat = "server" > < / asp control. In case you are new to .NET or haven't explored the relationship between ASP.NET and code-behind, we will start with some fundamentals. To begin, start Visual Studio .NET 2003 for the example but it should run on version 1.0. Create a new ASP.NET Web Application from the File | New Project menu item. After you select the ASP.NET Web Application template, VS.NET will create a bare bones Web project from the
ASP.NET: Running EloqueraDb in Desktop Mode in an ASP.NET Web Application Eloquera DB is a 100 percent .NET managed code object database that incorporates Desktop" mode. Here we show how you can use EloqueraDb in Desktop mode in an ASP.NET Web Application. I've written about EloqueraDb before; you can view the first article here static Eloquera.Client.DB GetOpenConnection() { db.OpenDatabase( "SampleDb" ); return db; } protected void Application_Start(object sender, EventArgs e) { const string dbName = "SampleDb" ; / / Desktop mode: db = new DB( "server = (local);options = none;" ); / / Custom int ID { get; set; } public string Title { get; set; } public string Message { get; set; } public DateTime LastUpdated { get; set; } } } In the single ASP.NET web page, I have a Gridview, and