title: Date Formatting Issues "YYYY-MM-DD" - no override/culture settings are working
body: <p>I have spent over a week of on and off again trying to solve this and I am coming up empty.</p>
  <p>I am writing an SSIS package and need to create a dynamic date for when the record is inserted (i'm using a script component to do this). I need it in the format &quot;yyyy-MM-dd&quot; as per the rest of our database.</p>
  <p>No matter what I try, it is constantly outputting the date as &quot;dd-MM-YYYY&quot; which is causing an overflow error as no day can be &quot;2021&quot; for example.</p>
  <p>Here is my latest attempt where I am trying to explicitly set the culture info and the pattern formatting.</p>
  <p>I read that the date format can be affected by your computers system date format settings. My computers date format is set to &quot;dd-MM-yy&quot;. Which does match the output i'm getting from my code.</p>
  <p><strong>Assuming I CANNOT adjust the server or system settings, how do I output my date in the &quot;yyyy-MM-dd&quot; format?</strong></p>
  <pre><code> var culture = CultureInfo.CreateSpecificCulture(&quot;en-US&quot;);
  var dateformat = new DateTimeFormatInfo();
  dateformat.FullDateTimePattern = &quot;dddd, mmmm dd, yyyy h:mm:ss tt&quot;;
  culture.DateTimeFormat = dateformat;
  System.Threading.Thread.CurrentThread.CurrentCulture = culture;
              
  
  //CultureInfo provider = CultureInfo.InvariantCulture;
  //IFormatProvider culture = new CultureInfo(&quot;en-US&quot;, true);
  updateDateTime = DateTime.ParseExact(&quot;2021/02/01&quot;, &quot;yyyy/MM/dd&quot;, culture);
  </code></pre>
  <p>You can see in my code example above, the final line, i'm currently explicitly writing out a date and updateDateTime should be the final yyyy-MM-dd value I need.</p>
  <p>Thank you so much for your help. This is driving me insane.</p>