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. General Programming
  3. C#
  4. convert date formats [modified]

convert date formats [modified]

Scheduled Pinned Locked Moved C#
comjsontutorialquestion
3 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
    stephan_007
    wrote on last edited by
    #1

    hy everyone! is it possible to easyly convert date formats into different formats. what i want to do is to convert a date format from english format to german format or vice versa. i do have a function which looks like public static string ConverFormat (string input, string format, string Cultureinfo) so when entering this function input contains the date, format contains the formatstring, in which format to display (e.g. {"mm/dd/yyyy"}) and cultureinfo contains the cultureinfo (e.g. en-US) to which the input has to be converted to (english or german format). so let's say input = 01.05.2008, format = {mm/dd/yyyy} and cultureinfo = en-US then the output should be 05/01/2008. in here how to convert datetime.now into desired format???[^] i found how to format the type of how to display the date. but i want to switch it from dd.mm.yyyy to e.g. mm/dd/yyyy or mm.dd.yyyy (following the the format declared in parameter format). do i have to do this by hand, meaning parsing the string and change it to the desired format or is there a chance to do this using default functions? thanks! Stephan.

    modified on Thursday, May 1, 2008 6:25 AM

    S P 2 Replies Last reply
    0
    • S stephan_007

      hy everyone! is it possible to easyly convert date formats into different formats. what i want to do is to convert a date format from english format to german format or vice versa. i do have a function which looks like public static string ConverFormat (string input, string format, string Cultureinfo) so when entering this function input contains the date, format contains the formatstring, in which format to display (e.g. {"mm/dd/yyyy"}) and cultureinfo contains the cultureinfo (e.g. en-US) to which the input has to be converted to (english or german format). so let's say input = 01.05.2008, format = {mm/dd/yyyy} and cultureinfo = en-US then the output should be 05/01/2008. in here how to convert datetime.now into desired format???[^] i found how to format the type of how to display the date. but i want to switch it from dd.mm.yyyy to e.g. mm/dd/yyyy or mm.dd.yyyy (following the the format declared in parameter format). do i have to do this by hand, meaning parsing the string and change it to the desired format or is there a chance to do this using default functions? thanks! Stephan.

      modified on Thursday, May 1, 2008 6:25 AM

      S Offline
      S Offline
      stephan_007
      wrote on last edited by
      #2

      i guess, i just found what i am looking for :) http://msdn.microsoft.com/en-us/library/5hh873ya.aspx[^] thanks anyway! Stephan.

      1 Reply Last reply
      0
      • S stephan_007

        hy everyone! is it possible to easyly convert date formats into different formats. what i want to do is to convert a date format from english format to german format or vice versa. i do have a function which looks like public static string ConverFormat (string input, string format, string Cultureinfo) so when entering this function input contains the date, format contains the formatstring, in which format to display (e.g. {"mm/dd/yyyy"}) and cultureinfo contains the cultureinfo (e.g. en-US) to which the input has to be converted to (english or german format). so let's say input = 01.05.2008, format = {mm/dd/yyyy} and cultureinfo = en-US then the output should be 05/01/2008. in here how to convert datetime.now into desired format???[^] i found how to format the type of how to display the date. but i want to switch it from dd.mm.yyyy to e.g. mm/dd/yyyy or mm.dd.yyyy (following the the format declared in parameter format). do i have to do this by hand, meaning parsing the string and change it to the desired format or is there a chance to do this using default functions? thanks! Stephan.

        modified on Thursday, May 1, 2008 6:25 AM

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        Please only use ISO 8601 formats -- yyyy-MM-dd

        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