Formatting gridview column: mm/dd/yy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bobby Edward

    Formatting gridview column: mm/dd/yy

    What is the formatstring for mm/dd/yy (gridview column)? I always want it
    to be 6 digits. Thanks.


  • Mark Rae [MVP]

    #2
    Re: Formatting gridview column: mm/dd/yy

    "Bobby Edward" <bobby@nobody.c omwrote in message
    news:OSoUkFbRJH A.5080@TK2MSFTN GP03.phx.gbl...
    What is the formatstring for mm/dd/yy (gridview column)? I always want it
    to be 6 digits. Thanks.
    I'm slightly confused because the format string for mm/dd/yy is "mm/dd/yy",
    so I presume that this isn't actually what you mean - please clarify...

    Also, be aware that not only is the above format not Y2k compatible, it's
    also completely ambiguous depending where you are in the world...


    --
    Mark Rae
    ASP.NET MVP


    Comment

    • Christiano Donke

      #3
      Re: Formatting gridview column: mm/dd/yy

      you may convert the column into a template field and format de bind...

      <asp:label (...) text='<%# format(Eval("Da te"),"MM/dd/yy")%>' />

      probably there are better ways to do this... but it still works...


      "Mark Rae [MVP]" <mark@markNOSPA Mrae.netescreve u na mensagem
      news:O%235QqXbR JHA.3808@TK2MSF TNGP02.phx.gbl. ..
      "Bobby Edward" <bobby@nobody.c omwrote in message
      news:OSoUkFbRJH A.5080@TK2MSFTN GP03.phx.gbl...
      >
      >What is the formatstring for mm/dd/yy (gridview column)? I always want
      >it to be 6 digits. Thanks.
      >
      I'm slightly confused because the format string for mm/dd/yy is
      "mm/dd/yy", so I presume that this isn't actually what you mean - please
      clarify...
      >
      Also, be aware that not only is the above format not Y2k compatible, it's
      also completely ambiguous depending where you are in the world...
      >
      >
      --
      Mark Rae
      ASP.NET MVP
      http://www.markrae.net

      Comment

      • Spider

        #4
        Re: Formatting gridview column: mm/dd/yy

        string temp = DateTime. Today.ToString( "MM/dd/yy",
        DateTimeFormatI nfo.InvariantIn fo);

        "Christiano Donke" <cdonke@digiexp ress.com.brдÈë ÏûÏ¢
        news:#rIuI0bRJH A.1172@TK2MSFTN GP03.phx.gbl...
        you may convert the column into a template field and format de bind...
        >
        <asp:label (...) text='<%# format(Eval("Da te"),"MM/dd/yy")%>' />
        >
        probably there are better ways to do this... but it still works...
        >
        >
        "Mark Rae [MVP]" <mark@markNOSPA Mrae.netescreve u na mensagem
        news:O%235QqXbR JHA.3808@TK2MSF TNGP02.phx.gbl. ..
        >"Bobby Edward" <bobby@nobody.c omwrote in message
        >news:OSoUkFbRJ HA.5080@TK2MSFT NGP03.phx.gbl.. .
        >>
        >>What is the formatstring for mm/dd/yy (gridview column)? I always want
        >>it to be 6 digits. Thanks.
        >>
        >I'm slightly confused because the format string for mm/dd/yy is
        >"mm/dd/yy", so I presume that this isn't actually what you mean - please
        >clarify...
        >>
        >Also, be aware that not only is the above format not Y2k compatible, it's
        >also completely ambiguous depending where you are in the world...
        >>
        >>
        >--
        >Mark Rae
        >ASP.NET MVP
        >http://www.markrae.net
        >
        >

        Comment

        • Mark Rae [MVP]

          #5
          Re: Formatting gridview column: mm/dd/yy

          "Spider" <NetSpidertj@21 cn.comwrote in message
          news:e3r5K6fRJH A.1908@TK2MSFTN GP04.phx.gbl...
          >>Also, be aware that not only is the above format not Y2k compatible,
          >>it's also completely ambiguous depending where you are in the world...
          >>
          >you may convert the column into a template field and format de bind...
          >>
          ><asp:label (...) text='<%# format(Eval("Da te"),"MM/dd/yy")%>' />
          >>
          >probably there are better ways to do this... but it still works...
          >>you may convert the column into a template field and format de bind...
          >>
          ><asp:label (...) text='<%# format(Eval("Da te"),"MM/dd/yy")%>' />
          >>
          >probably there are better ways to do this... but it still works...
          >
          string temp = DateTime. Today.ToString( "MM/dd/yy",
          DateTimeFormatI nfo.InvariantIn fo);
          Which would result in a string like "02/03/04". Apart from not being Y2k
          compliant, this is *completely* ambiguous.



          In the US and some parts of Canada, Kenya and the Philippines, that date
          would be interpreted as 3 February 2004.

          In China and some European territories, it would be interpreted as 4 March
          2002.

          In most of the rest of the world, it would be interpreted as 2 March 2004.


          --
          Mark Rae
          ASP.NET MVP


          Comment

          • Bobby Edward

            #6
            Re: Formatting gridview column: mm/dd/yy

            In the US and some parts of Canada, Kenya and the Philippines, that date
            would be interpreted as 3 February 2004.
            >
            True. But this website is for US people only. ;)


            Comment

            • Mark Rae [MVP]

              #7
              Re: Formatting gridview column: mm/dd/yy

              "Bobby Edward" <bobby@nobody.c omwrote in message
              news:Oi11GUmRJH A.4824@TK2MSFTN GP02.phx.gbl...
              >In the US and some parts of Canada, Kenya and the Philippines, that date
              >would be interpreted as 3 February 2004.
              >>
              True. But this website is for US people only. ;)
              And US people aren't interested in Y2k compliance - fair enough...


              --
              Mark Rae
              ASP.NET MVP


              Comment

              • Bobby Edward

                #8
                Re: Formatting gridview column: mm/dd/yy

                "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
                news:%23o0$YtnR JHA.5056@TK2MSF TNGP04.phx.gbl. ..
                >
                And US people aren't interested in Y2k compliance - fair enough...
                >
                LOL good one! ;)

                The dates will be only from 2008 forward. It's ok. Thanks. :)


                Comment

                Working...