DateTimePicker - Format Value

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

    #1

    DateTimePicker - Format Value

    My system short date format is dd/mm/yy.

    The DateTimePicker returns mm/dd/yyyy hh:mm:ss PM.

    I need to get this value formated into dd/mm/yyyy regardless of the system
    short date format, what do I need to use please.

    Regards
    Terry


  • Herfried K. Wagner [MVP]

    #2
    Re: DateTimePicker - Format Value

    "Terry" <news-grps@whiteHYPHE NlightDOTme.uks chrieb:
    My system short date format is dd/mm/yy.
    >
    The DateTimePicker returns mm/dd/yyyy hh:mm:ss PM.
    >
    I need to get this value formated into dd/mm/yyyy regardless of the system
    short date format, what do I need to use please.

    The DateTimePicker control's 'Value' property returns a 'Date' instance,
    which you can format by calling its 'ToString' method and passing
    appropriate formatting options to this method.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    • diego

      #3
      Re: DateTimePicker - Format Value

      Hi Terry,

      Try setting the Format property = Custom and CustomFormat property =
      "dd/MM/yyyy"

      hth

      diego

      On Mar 29, 5:32 am, "Terry" <news-g...@whiteHYPHE NlightDOTme.uk>
      wrote:
      My system short date format is dd/mm/yy.
      >
      The DateTimePicker returns mm/dd/yyyy hh:mm:ss PM.
      >
      I need to get this value formated into dd/mm/yyyy regardless of the system
      short date format, what do I need to use please.
      >
      Regards
      Terry

      Comment

      • Terry

        #4
        Re: DateTimePicker - Format Value

        Thanks Herfield, perfect, just ready to drop right into a textbox.
        Regards

        Terry
        "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.atwrot e in message
        news:%23UKHnaYc HHA.4188@TK2MSF TNGP02.phx.gbl. ..
        "Terry" <news-grps@whiteHYPHE NlightDOTme.uks chrieb:
        >My system short date format is dd/mm/yy.
        >>
        >The DateTimePicker returns mm/dd/yyyy hh:mm:ss PM.
        >>
        >I need to get this value formated into dd/mm/yyyy regardless of the
        >system short date format, what do I need to use please.
        >
        >
        The DateTimePicker control's 'Value' property returns a 'Date' instance,
        which you can format by calling its 'ToString' method and passing
        appropriate formatting options to this method.
        >
        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
        >

        Comment

        • Terry

          #5
          Re: DateTimePicker - Format Value

          Thanks Diego,

          This will be useful for changing the displayed value in the control, at the
          moment long date is OK. Thanks for the usefull info.
          Regards

          Terry

          "diego" <diegobph@yahoo .comwrote in message
          news:1175133935 .880118.218970@ o5g2000hsb.goog legroups.com...
          Hi Terry,
          >
          Try setting the Format property = Custom and CustomFormat property =
          "dd/MM/yyyy"
          >
          hth
          >
          diego
          >
          On Mar 29, 5:32 am, "Terry" <news-g...@whiteHYPHE NlightDOTme.uk>
          wrote:
          >My system short date format is dd/mm/yy.
          >>
          >The DateTimePicker returns mm/dd/yyyy hh:mm:ss PM.
          >>
          >I need to get this value formated into dd/mm/yyyy regardless of the
          >system
          >short date format, what do I need to use please.
          >>
          >Regards
          >Terry
          >

          Comment

          • Terry

            #6
            Re: DateTimePicker - Format Value

            Sorry for the name typo, Herfried.
            Regards

            "Terry" <news-grps@whiteHYPHE NlightDOTme.ukw rote in message
            news:utJU$pjcHH A.4032@TK2MSFTN GP02.phx.gbl...
            Thanks Herfield, perfect, just ready to drop right into a textbox.
            Regards
            >
            Terry
            "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.atwrot e in message
            news:%23UKHnaYc HHA.4188@TK2MSF TNGP02.phx.gbl. ..
            >"Terry" <news-grps@whiteHYPHE NlightDOTme.uks chrieb:
            >>My system short date format is dd/mm/yy.
            >>>
            >>The DateTimePicker returns mm/dd/yyyy hh:mm:ss PM.
            >>>
            >>I need to get this value formated into dd/mm/yyyy regardless of the
            >>system short date format, what do I need to use please.
            >>
            >>
            >The DateTimePicker control's 'Value' property returns a 'Date' instance,
            >which you can format by calling its 'ToString' method and passing
            >appropriate formatting options to this method.
            >>
            >--
            >M S Herfried K. Wagner
            >M V P <URL:http://dotnet.mvps.org/>
            >V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
            >>
            >
            >

            Comment

            Working...