Re: Date Convert

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Ignacio Machin \( .NET/ C# MVP \) ("Ignacio)
Date: 12/13/04


Date: Mon, 13 Dec 2004 08:43:01 -0500

Hi,

 You can convert a DateTime to string as desired using DateTime.ToString() ,
like this:
DateTime.Today.ToString( "dd/MM/yy", DateTimeFormatInfo.InvariantInfo );

In a similar way you can use DateTime.Parse or DateTime.ParseExact

Cheers,

-- 
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Islam Elkhayat" <islamegy@yahoo.com> wrote in message 
news:%23yLPfhR4EHA.524@TK2MSFTNGP09.phx.gbl...
> In my C# Webapplication..
> I enter the date in a textbox using popup Calender in the format 
> MM/dd/yyyy..
> when i retrieve date from Sql server for updating using datarow to fill 
> the textbox the date format dd/MM/yyyy hh-mm-ss i want to convert it back 
> to the original format & ommit the time..
>
> How can  i convert this back so i void the exception if user didn't change 
> date in the update form??
> Any help plz
>
>
> 


Relevant Pages

  • RE: Textbox LostFocus event fires after Command Buttons OnClick e
    ... the textbox formats the string into ... I like the LostFocus event, because I've got upwards of 14 such ... different strings but must all be formatted in the correct format. ...
    (microsoft.public.dotnet.languages.vb)
  • RE: Textbox LostFocus event fires after Command Buttons OnClick event
    ... The pending lost focus event will be fired ... I've a form that has a textbox that allows the user to enter a ... the textbox formats the string into a ... different strings but must all be formatted in the correct format. ...
    (microsoft.public.dotnet.languages.vb)
  • RE: Textbox LostFocus event fires after Command Buttons OnClick e
    ... I've a form that has a textbox that allows the user to enter a string. ... On the LostFocus event, the textbox formats the string into a preferred ... strings but must all be formatted in the correct format. ...
    (microsoft.public.dotnet.languages.vb)
  • Textbox LostFocus event fires after Command Buttons OnClick event
    ... I've a form that has a textbox that allows the user to enter a string. ... On the LostFocus event, the textbox formats the string into a preferred ... strings but must all be formatted in the correct format. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Date Convert
    ... You can convert a DateTime to string as desired using DateTime.ToString, ... DateTime.Today.ToString("dd/MM/yy", DateTimeFormatInfo.InvariantInfo); ... > the textbox the date format dd/MM/yyyy hh-mm-ss i want to convert it back ...
    (microsoft.public.dotnet.languages.csharp)