Easy way to convert datetime (mysql)

Discussion in 'ASP .Net' started by Bobby Edward, Nov 5, 2008.

  1. Bobby Edward

    Bobby Edward Guest

    In mysql the db stores date/time as this: yyyy-mm-dd

    Is there an easy way to convert it to mm/dd/yyyy?

    How about if it shows up in a datagrid column?

    How about if the time is appended. For example, my sql is this format:
    yyyy-mm-dd hh:ss:mm (no AM/PM)
     
    Bobby Edward, Nov 5, 2008
    #1
    1. Advertising

  2. Bobby Edward

    Bobby Edward Guest

    >> Is there an easy way to convert it to mm/dd/yyyy?
    >
    > Convert it where? In a query, a stored procedure, during presentation on
    > screen...?


    I want to always display the date/time in this format: mm/dd/yyyy hh:mm
    AM/PM

    But, I always need to store the date/time in the mysql format: yyyy-mm-dd
    hh:mm
    I am using XSD datasets which have a built insert/update commands.

    > The DataGrid control has been deprecated in favour of the GridView control
    > since ASP.NET v2.0 - to format data in GridView controls, use something
    > like this:
    >
    > <asp:BoundField DataField="MySqlDataField"
    > DataFormatString="{0:mm/dd/yyyy}" HtmlEncode="false" />


    Thanks. The DataFormatString should work fine.

    >
    > Also, the data format mm/dd/yyyy is ambiguous - in that format, today's
    > date would be shown as 11/06/2008 which, to most of the Western world,
    > would be understood as 11th June 2008, not 6th November 2008.
    >


    The requirements are for mm/dd/yyyy. :)
     
    Bobby Edward, Nov 6, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    710
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    536
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    392
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    337
    Martin
    Dec 27, 2008
  5. Justin Voelker
    Replies:
    2
    Views:
    264
    Dr J R Stockton
    Dec 2, 2008
Loading...

Share This Page