custom date formatting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QmVu?=

    custom date formatting

    All -

    I have VB2008. On the form I have a date picker and a text box.
    I put would like to display a date format in the form of "MM-DD-YYYY" or
    "MM-YYYY"
    I am new to vb2008, can you show me how to do this?

    Thank you,

    Ben



    --

  • kimiraikkonen

    #2
    Re: custom date formatting

    On Oct 9, 11:03 pm, Ben <B...@discussio ns.microsoft.co mwrote:
    All -
    >
    I have VB2008. On the form I have a date picker and a text box.
    I put would like to display a date format in the form of "MM-DD-YYYY" or
    "MM-YYYY"
    I am new to vb2008, can you show me how to do this?
    >
    Thank you,
    >
    Ben
    >
    --
    Assuming you have a "DateTimePicker " control on your form, first
    change DateTimePicker' s "Format" property to "Custom" then set its
    "CustomForm at" property to "mm-dd-yyyy" (without quotes, of course)
    through properties window. Follow the same for "mm-yyyy" format.

    Now you can show it in your textbox like that;
    TextBox1.Text = DateTimePicker1 .Text

    Hope this helps,

    Onur Güzel

    Comment

    • Harry

      #3
      Re: custom date formatting


      "Ben" <Ben@discussion s.microsoft.com wrote in message
      news:EDB2289A-9373-48C9-ACC3-E4C6A35D847F@mi crosoft.com...
      All -
      >
      I have VB2008. On the form I have a date picker and a text box.
      I put would like to display a date format in the form of "MM-DD-YYYY" or
      "MM-YYYY"
      I am new to vb2008, can you show me how to do this?
      >
      Thank you,
      >
      Ben
      >
      Set the Format property and then set Custom Format to "MM-DD-YYYY" or
      whatever


      Comment

      • Cor Ligthert[MVP]

        #4
        Re: custom date formatting

        Ben,

        You can custom a date to any format, some are predifined others not.

        By instance with

        String x = Now.ToString("M M-dd-yyyy")

        Be aware that the month is with upper caption, as lower caption means
        minutes.

        Cor


        "Ben" <Ben@discussion s.microsoft.com schreef in bericht
        news:EDB2289A-9373-48C9-ACC3-E4C6A35D847F@mi crosoft.com...
        All -
        >
        I have VB2008. On the form I have a date picker and a text box.
        I put would like to display a date format in the form of "MM-DD-YYYY" or
        "MM-YYYY"
        I am new to vb2008, can you show me how to do this?
        >
        Thank you,
        >
        Ben
        >
        >
        >
        --
        >

        Comment

        • kimiraikkonen

          #5
          Re: custom date formatting

          On Oct 9, 11:27 pm, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
          On Oct 9, 11:03 pm, Ben <B...@discussio ns.microsoft.co mwrote:
          >
          All -
          >
          I have  VB2008.  On the form I have a date picker and a text box.
          I put would like to display a date format in the form of "MM-DD-YYYY" or
          "MM-YYYY"
          I am new to vb2008, can you show me how to do this?
          >
          Thank you,
          >
          Ben
          >
          --
          >
          Assuming you have a "DateTimePicker " control on your form, first
          change DateTimePicker' s "Format" property to "Custom" then set its
          "CustomForm at" property to "mm-dd-yyyy" (without quotes, of course)
          through properties window. Follow the same for "mm-yyyy" format.
          >
          Now you can show it in your textbox like that;
          TextBox1.Text = DateTimePicker1 .Text
          >
          Hope this helps,
          >
          Onur Güzel
          To make a correction for myself, you can use "MM-dd-yyyy" to get date
          format as uppercase "MM" represents month value whereas lowercase "mm"
          represents minutes. Same, you can use "MM-YYYY" as date.

          And sure, you can use Short, Long formats which are presented
          alreadyby DateTimePicker.

          Thanks,

          Onur Güzel

          Comment

          • Cor Ligthert[MVP]

            #6
            Re: custom date formatting

            Onur,

            I saw it, but did not know how to phrase it, therefore I made a new message.

            :-)

            Cor

            "kimiraikko nen" <kimiraikkonen8 5@gmail.comschr eef in bericht
            news:f25274fb-57c9-4521-968e-fdfe62b99749@8g 2000hse.googleg roups.com...
            On Oct 9, 11:27 pm, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
            On Oct 9, 11:03 pm, Ben <B...@discussio ns.microsoft.co mwrote:
            >
            All -
            >
            I have VB2008. On the form I have a date picker and a text box.
            I put would like to display a date format in the form of "MM-DD-YYYY" or
            "MM-YYYY"
            I am new to vb2008, can you show me how to do this?
            >
            Thank you,
            >
            Ben
            >
            --
            >
            Assuming you have a "DateTimePicker " control on your form, first
            change DateTimePicker' s "Format" property to "Custom" then set its
            "CustomForm at" property to "mm-dd-yyyy" (without quotes, of course)
            through properties window. Follow the same for "mm-yyyy" format.
            >
            Now you can show it in your textbox like that;
            TextBox1.Text = DateTimePicker1 .Text
            >
            Hope this helps,
            >
            Onur Güzel
            To make a correction for myself, you can use "MM-dd-yyyy" to get date
            format as uppercase "MM" represents month value whereas lowercase "mm"
            represents minutes. Same, you can use "MM-YYYY" as date.

            And sure, you can use Short, Long formats which are presented
            alreadyby DateTimePicker.

            Thanks,

            Onur Güzel


            Comment

            • =?Utf-8?B?QmVu?=

              #7
              RE: custom date formatting

              Thank you all

              Ben



              --



              "Ben" wrote:
              All -
              >
              I have VB2008. On the form I have a date picker and a text box.
              I put would like to display a date format in the form of "MM-DD-YYYY" or
              "MM-YYYY"
              I am new to vb2008, can you show me how to do this?
              >
              Thank you,
              >
              Ben
              >
              >
              >
              --
              >

              Comment

              Working...