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. DateTime.ParseExact method query [modified]

DateTime.ParseExact method query [modified]

Scheduled Pinned Locked Moved C#
database
2 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.
  • C Offline
    C Offline
    chandler83
    wrote on last edited by
    #1

    hi all, i need to know wht input will satisfy this condition DateTime tm=DateTime.ParseExact(sar[1],new String [] {"t","T"},CultureInfo.CurrentCulture,DateTimeStyles.AllowWhiteSpaces|DateTimeStyles.NoCurrentDateDefault); in this above sar[] wht should i pass in this below is my method which accepts DayofweekandTime as input. String [] sar=delay.Split(new char [] {' '}); if(sar.Length<2) return DateTime.MinValue; sar[0]=sar[0].Trim().ToUpper(); DateTime tm=DateTime.ParseExact(sar[1],new String [] {"t","T"},CultureInfo.CurrentCulture,DateTimeStyles.AllowWhiteSpaces|DateTimeStyles.NoCurrentDateDefault); tm=new DateTime(2003,1,6)+new TimeSpan(0,tm.Hour,tm.Minute,tm.Second,tm.Millisecond); for(int i=0; i<7; i++) { if(tm.ToString("ddd").ToUpper()==sar[0]) return tm; tm+=new TimeSpan(1,0,0,0); } return DateTime.MinValue; thanks in advance.... -- modified at 2:48 Friday 25th August, 2006

    G 1 Reply Last reply
    0
    • C chandler83

      hi all, i need to know wht input will satisfy this condition DateTime tm=DateTime.ParseExact(sar[1],new String [] {"t","T"},CultureInfo.CurrentCulture,DateTimeStyles.AllowWhiteSpaces|DateTimeStyles.NoCurrentDateDefault); in this above sar[] wht should i pass in this below is my method which accepts DayofweekandTime as input. String [] sar=delay.Split(new char [] {' '}); if(sar.Length<2) return DateTime.MinValue; sar[0]=sar[0].Trim().ToUpper(); DateTime tm=DateTime.ParseExact(sar[1],new String [] {"t","T"},CultureInfo.CurrentCulture,DateTimeStyles.AllowWhiteSpaces|DateTimeStyles.NoCurrentDateDefault); tm=new DateTime(2003,1,6)+new TimeSpan(0,tm.Hour,tm.Minute,tm.Second,tm.Millisecond); for(int i=0; i<7; i++) { if(tm.ToString("ddd").ToUpper()==sar[0]) return tm; tm+=new TimeSpan(1,0,0,0); } return DateTime.MinValue; thanks in advance.... -- modified at 2:48 Friday 25th August, 2006

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      You can input anything that matches the ShortTimePattern or LongTimePattern of the current culture.

      --- b { font-weight: normal; }

      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