title: How to decode Seagate's hard drive date code in a Bash script
body: <p><a href="http://www.seagate.com" rel="nofollow">Seagate</a> hard drives display a code instead of the manufacturing date. The code is described <a href="http://www.lerti.fr/web/public/NoteTechnique03-v1.01.pdf" rel="nofollow">here</a> and an online decoder is available <a href="http://www.westernnetworks.com/tools/seagatedatecode2.php" rel="nofollow">here</a>.</p>
  
  <p>In short, it's a 4 or 5 digit number of the form <code>YYWWD</code> or <code>YYWD</code>, where:</p>
  
  <ul>
  <li><code>YY</code> is the year, 00 is year 1999</li>
  <li><code>W</code> or <code>WW</code> is the week number beginning 1</li>
  <li><code>D</code> is day of week beginning 1</li>
  <li>Week 1 begins on the first saturday of July in the stated year</li>
  </ul>
  
  <p>Examples</p>
  
  <ul>
  <li>06212 means Sunday 20 November 2005 </li>
  <li>0051  means Saturday 31 July 1999 </li>
  </ul>
  
  <p>How can this be decoded in a <code>bash</code> script ?</p>