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. Date format

Date format

Scheduled Pinned Locked Moved ASP.NET
questionlounge
3 Posts 3 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.
  • I Offline
    I Offline
    izotov
    wrote on last edited by
    #1

    I would like to write hungarian style formatted dates to response. The hungarian short date format is "yyyy.MM.dd.". I have tried the following settings: Session.LCID = 1038 or Thread.CurrentThread.CurrentCulture = New CultureInfo(1038) Thread.CurrentThread.CurrentUICulture = New CultureInfo(1038) (1038 is the hungarian locale ID). The result is allways the same, the displayed date format is "M.d.yyyy" (which seems to be the general date format). If I write a Windows application instead of web application the date formatting is correct again... Any idea? Thanks! (K)

    V L 2 Replies Last reply
    0
    • I izotov

      I would like to write hungarian style formatted dates to response. The hungarian short date format is "yyyy.MM.dd.". I have tried the following settings: Session.LCID = 1038 or Thread.CurrentThread.CurrentCulture = New CultureInfo(1038) Thread.CurrentThread.CurrentUICulture = New CultureInfo(1038) (1038 is the hungarian locale ID). The result is allways the same, the displayed date format is "M.d.yyyy" (which seems to be the general date format). If I write a Windows application instead of web application the date formatting is correct again... Any idea? Thanks! (K)

      V Offline
      V Offline
      V 0
      wrote on last edited by
      #2

      you have to set the culture in order to set the dateformat, I 've had so many problems with the DateTime Object that I eventually made one myself. This way I at least now what to expect. good luck. "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

      1 Reply Last reply
      0
      • I izotov

        I would like to write hungarian style formatted dates to response. The hungarian short date format is "yyyy.MM.dd.". I have tried the following settings: Session.LCID = 1038 or Thread.CurrentThread.CurrentCulture = New CultureInfo(1038) Thread.CurrentThread.CurrentUICulture = New CultureInfo(1038) (1038 is the hungarian locale ID). The result is allways the same, the displayed date format is "M.d.yyyy" (which seems to be the general date format). If I write a Windows application instead of web application the date formatting is correct again... Any idea? Thanks! (K)

        L Offline
        L Offline
        Luis Alonso Ramos
        wrote on last edited by
        #3

        The easy way is:

        string strDateInYourFormat = dateMyDate.ToString("yyyy.MM.dd");
        

        Good luck! -- LuisR


        Luis Alonso Ramos Intelectix - Chihuahua, Mexico Not much here: My CP Blog!

        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