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. Converting Dates

Converting Dates

Scheduled Pinned Locked Moved ASP.NET
dockertutorial
5 Posts 2 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.
  • S Offline
    S Offline
    Silmar01
    wrote on last edited by
    #1

    Any idea how I can get his to read for example September 2002 <%# DataBinder.Eval(Container.DataItem, "CompletionDate")%>

    Richard DeemingR 1 Reply Last reply
    0
    • S Silmar01

      Any idea how I can get his to read for example September 2002 <%# DataBinder.Eval(Container.DataItem, "CompletionDate")%>

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Assuming CompletionDate is stored as a DateTime object, try:

      DataBinder.Eval(Container.DataItem, "CompletionDate", "MMMM yyyy")

      NB: The case is important - M means month, m means minutes.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      S 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Assuming CompletionDate is stored as a DateTime object, try:

        DataBinder.Eval(Container.DataItem, "CompletionDate", "MMMM yyyy")

        NB: The case is important - M means month, m means minutes.


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        S Offline
        S Offline
        Silmar01
        wrote on last edited by
        #3

        hmm tried that by editing the line to the following <%# DataBinder.Eval(Container.DataItem, "CompletionDate", "MMMM yyyy")%> yet it just prints out MMMM yyyy instead of any date

        Richard DeemingR 1 Reply Last reply
        0
        • S Silmar01

          hmm tried that by editing the line to the following <%# DataBinder.Eval(Container.DataItem, "CompletionDate", "MMMM yyyy")%> yet it just prints out MMMM yyyy instead of any date

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          Whoops! :-O That should be:

          DataBinder.Eval(Container.DataItem, "CompletionDate", "{0:MMMM yyyy}")


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          S 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            Whoops! :-O That should be:

            DataBinder.Eval(Container.DataItem, "CompletionDate", "{0:MMMM yyyy}")


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            S Offline
            S Offline
            Silmar01
            wrote on last edited by
            #5

            Yeap just got it as you replied. Thanks for leading me in the right direction :) Certainly different from using MonthName() :-O

            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