Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: String to Date

    rob,

    with vb you can get a string in the format
    "DD/MM/YYYY HH:MM:SS"
    or month first, depending on your windows locale, to a Date object by saying

    Dim myDate As Date
    myDate = "01/01/2003 16:32"

    "Robert" <robert_dx@gmx.com> wrote in message
    news:086801c34478$4d1baed0$a301280a@phx.gbl...
    > Hi,
    >
    > how can a String like "3/22/1999 6:0:0" be converted to a
    > DateTime object. The Parse method does not work and
    > ParseExact is not really explained in the help.
    >
    > Does anyone know a solution?
    >
    > Thanks
    > Rob

    Daniel Bass Guest

  2. Similar Questions and Discussions

    1. Why can I pass a string, but not a date?
      I have this custom component that at the moment just repeats the passed in value. It works if I pass in a string, but if I pass the date I...
    2. extract a date from a string
      I'm trying to figure out a way to extract dates from a string of any length using strtotime. strtotime only works if the date is formatted to GNU...
    3. Help on processinf Date String.
      Pandey Rajeev-A19514 wrote at Wed, 10 Sep 2003 11:56:01 +0530: Here's a complete example working with Date::Manip. use Date::Manip; my...
    4. from epoch to date string
      greetings, is there a revers of this below -- in a one-liner format? i.e. input to be `date` and output to be number of seconds since epoch. ...
    5. Cast from String To Date
      Are you validating the entry before the cast occurs? My guess would be that someone is entering a string that couldn't possible be a date. Try...
  3. #2

    Default Re: String To Date

    The Convert.ToDateTime method should work no matter which language you're
    using.
    Here's more info:
    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemconvertclasstodatetimetopic13.asp[/url]

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]


    "Jim Owen" <jkoseattle@comcast.net> wrote in message
    news:OMM0mzJUDHA.3192@tk2msftngp13.phx.gbl...
    > Simple question:
    >
    > User enters date into text field. I need to post it to an object in a
    > System.DateTime format. How do I turn his string into a date?
    >
    > --
    > - Jim Owen
    > 206-501-6936
    >
    >

    Steve C. Orr, MCSD Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139