how do I convert date in integer format to datetime without using DateTime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Prithivi989
    New Member
    • Jun 2013
    • 1

    how do I convert date in integer format to datetime without using DateTime

    How do I convert date in integer format to DateTime without using DateTime?

    I have tried:
    Code:
    Regex regex = new Regex(@"^(0[1-9]|1[012])(0[0-9]|1[0-9]|2[0-9]|3[01])(1[789]|[2-9][0-9])\d\d+$");
    if (regex.IsMatch(txt_fromdate.Text) == true)
                {
                    DateTime dt = DateTime.ParseExact(txt_fromdate.Text, "MMddyyyy", null);
                }
    Last edited by Frinavale; Jun 12 '13, 06:39 PM. Reason: Added the question to the body of the thread.
  • vijay6
    New Member
    • Mar 2010
    • 158

    #2
    Hey Prithivi989, i think we can't get the exact date.

    Case 1: If the number is 12122012 means we can find out the date (12th December 2012).

    Case 2: If the number is 122012 means we can find out the date (2nd January 2012).

    Case 3: If the number is 1232012 means we can find out the date (3rd December 2012).

    Case 4: But the problem is if the number is 1122012 means then can't say the exact date (2nd November 2012 or 12th January 2012).

    Comment

    Working...