Results 1 to 2 of 2

Thread: [RESOLVED] string to date format

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2007
    Posts
    694

    Resolved [RESOLVED] string to date format

    Hi,
    How do I check if the file's date is today's date?
    i.e. FileA20120216.csv
    As you can see the date in th efile is "20120216" and i would like to compare this to todays date to see if they are the same or not.
    How is this done please?
    Thanks

  2. #2
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: string to date format

    The following converts the string to a DateTime object:
    Code:
    DateTime.ParseExact("20120216", "yyyyMMdd", null);
    Now all you need to do is compare that to DateTime.Now.
    Delete it. They just clutter threads anyway.

Posting Permissions

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



Click Here to Expand Forum to Full Width