![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Problems formating date I try to format a date using following myDateTime.ToString("dd/MM/yyyy") Which I assumed would give me a date seperated by slashed, but it gives me the date using '-'. Can anyone tell me what I am doing wrong? I export to csv and the goal is to let the user be able specify the date formating. TIA Soeren D. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Problems formating date "Søren D" <null@xxxxxx> schreef in bericht news:uyot$5S6JHA.1416@xxxxxx Quote: >I try to format a date using following > > myDateTime.ToString("dd/MM/yyyy") > > Which I assumed would give me a date seperated by slashed, but it gives me > the date using '-'. > > Can anyone tell me what I am doing wrong? I export to csv and the goal is > to let the user be able specify the date formating. > > TIA > > Soeren D. From the .net framework help file: / Represents the date separator defined in the current DateTimeFormatInfo.DateSeparator property. ' Represents a quoted string (apostrophe). Displays the literal value of any string between two apostrophe (') characters. In your case, the '/' is translated to a '-' because in your system, the current date seperator is a '-'. So you need to use a literal value: myDateTime.ToString("dd'/'MM'/'yyyy"); or: mySeperator = "/"; myDateTime.ToString("dd'"+mySeperator+"'MM'"+mySeperator+"'yyyy"); regards, Marcel |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Date problems in MS-DOS program | Vista installation & setup | |||
| Date format problems after applying Vista SP1 | Vista General | |||
| What problems have you had to date with Vista? | General Discussion | |||
| Date problems in PS | PowerShell | |||
| Date/Time Reset Problems | Vista General | |||