Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. dd/mm/yyyy to mm/dd/yyyy format

dd/mm/yyyy to mm/dd/yyyy format

Scheduled Pinned Locked Moved ASP.NET
tutorial
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 3879881
    wrote on last edited by
    #1

    Hi in one of my string i have assigned date, the format is dd/mm/yyyy Now i want to change the string as mm/dd/yyyy plz give me a guide how to change it

    Thanks & Regards, Member 3879881, please don't forget to vote on the post

    A 1 Reply Last reply
    0
    • M Member 3879881

      Hi in one of my string i have assigned date, the format is dd/mm/yyyy Now i want to change the string as mm/dd/yyyy plz give me a guide how to change it

      Thanks & Regards, Member 3879881, please don't forget to vote on the post

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Member 3879881 wrote:

      Hi in one of my string i have assigned date, the format is dd/mm/yyyy Now i want to change the string as mm/dd/yyyy

      There are many ways to do it . this is an example. string strdate = String.Format("{0:yyyyMMdd}", DateTime.Now); Try google, there are lots of example over there .

      cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net

      M 1 Reply Last reply
      0
      • A Abhijit Jana

        Member 3879881 wrote:

        Hi in one of my string i have assigned date, the format is dd/mm/yyyy Now i want to change the string as mm/dd/yyyy

        There are many ways to do it . this is an example. string strdate = String.Format("{0:yyyyMMdd}", DateTime.Now); Try google, there are lots of example over there .

        cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net

        M Offline
        M Offline
        Member 3879881
        wrote on last edited by
        #3

        Hi abhijit Thanks for ur reply, See i have a date format already in a string, in this format(dd/mm/yyyy); so my string have a value like this 21/02/2008 Now i have to change the string as mm/dd/yyyy (i.e: 02/21/2008) if u have any idea plz share with me

        Thanks & Regards, Member 3879881, please don't forget to vote on the post

        S A M 3 Replies Last reply
        0
        • M Member 3879881

          Hi abhijit Thanks for ur reply, See i have a date format already in a string, in this format(dd/mm/yyyy); so my string have a value like this 21/02/2008 Now i have to change the string as mm/dd/yyyy (i.e: 02/21/2008) if u have any idea plz share with me

          Thanks & Regards, Member 3879881, please don't forget to vote on the post

          S Offline
          S Offline
          scotchy2hotty2k2
          wrote on last edited by
          #4

          string date = textBox1.Text; DateTimeFormatInfo dateTimeFormatterProvider = DateTimeFormatInfo.CurrentInfo.Clone() as DateTimeFormatInfo; dateTimeFormatterProvider.ShortDatePattern = "dd/MM/yyyy"; DateTime dateTime = DateTime.Parse(date, dateTimeFormatterProvider); string formatted = dateTime.ToString("MM/dd/yyyy"); response.write(formatted); I hope this resolves ur problem

          1 Reply Last reply
          0
          • M Member 3879881

            Hi abhijit Thanks for ur reply, See i have a date format already in a string, in this format(dd/mm/yyyy); so my string have a value like this 21/02/2008 Now i have to change the string as mm/dd/yyyy (i.e: 02/21/2008) if u have any idea plz share with me

            Thanks & Regards, Member 3879881, please don't forget to vote on the post

            A Offline
            A Offline
            Abhijit Jana
            wrote on last edited by
            #5

            Member 3879881 wrote:

            See i have a date format already in a string, in this format(dd/mm/yyyy); so my string have a value like this 21/02/2008

            I will suggest you to retrieve the required String format here itself . rather than taking it some other format.

            Member 3879881 wrote:

            Now i have to change the string as mm/dd/yyyy (i.e: 02/21/2008) if u have any idea plz share with me

            use Split :)

            cheers, Abhijit CodeProject MVP My Blog :Abhijit's World of .Net

            1 Reply Last reply
            0
            • M Member 3879881

              Hi abhijit Thanks for ur reply, See i have a date format already in a string, in this format(dd/mm/yyyy); so my string have a value like this 21/02/2008 Now i have to change the string as mm/dd/yyyy (i.e: 02/21/2008) if u have any idea plz share with me

              Thanks & Regards, Member 3879881, please don't forget to vote on the post

              M Offline
              M Offline
              mr_muskurahat
              wrote on last edited by
              #6

              yourdatevariable.ToString("mm/dd/yyyy");

              umerumerumer

              B 1 Reply Last reply
              0
              • M mr_muskurahat

                yourdatevariable.ToString("mm/dd/yyyy");

                umerumerumer

                B Offline
                B Offline
                bVagadishnu
                wrote on last edited by
                #7

                mr_muskurahat wrote:

                yourdatevariable.ToString("mm/dd/yyyy");

                If you are using DateTime: mm is minutes MM is Month yourdatevariable.ToString("MM/dd/yyyy");

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups