Professional Web Applications Themes

String to Date - ASP.NET General

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_dxgmx.com> wrote in message news:086801c34478$4d1baed0$a301280aphx.gbl... > Hi, > > how can a String like "3/22/1999 6:0:0" be converted to a > DateTime object. The P method does not work and > PExact is not really explained in the help. > > Does anyone know a solution? > > Thanks > Rob...

  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_dxgmx.com> wrote in message
    news:086801c34478$4d1baed0$a301280aphx.gbl...
    > Hi,
    >
    > how can a String like "3/22/1999 6:0:0" be converted to a
    > DateTime object. The P method does not work and
    > PExact is not really explained in the help.
    >
    > Does anyone know a solution?
    >
    > Thanks
    > Rob

    Daniel Bass Guest

  2. #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" <jkoseattlecomcast.net> wrote in message
    news:OMM0mzJUDHA.3192tk2msftngp13.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

Similar Threads

  1. Why can I pass a string, but not a date?
    By Ian Skinner in forum Macromedia Flex General Discussion
    Replies: 3
    Last Post: June 26th, 06:15 PM
  2. How to p a string into a date?
    By csteinola in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: March 20th, 05:05 PM
  3. extract a date from a string
    By dave in forum PHP Development
    Replies: 1
    Last Post: April 7th, 09:33 AM
  4. String Date to apoch
    By Paul Kraus in forum PERL Beginners
    Replies: 14
    Last Post: December 13th, 11:20 AM
  5. Cast from String To Date
    By S. Justin Gengo in forum ASP.NET General
    Replies: 0
    Last Post: July 16th, 05:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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