<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <id>tag:www.refactormycode.com,2007:users96</id>
  <link type="application/atom+xml" href="http://www.refactormycode.com/users/96" rel="self"/>
  <title>https://getopenid.com/thegenericgeek</title>
  <updated>Mon Oct 01 09:58:22 -0700 2007</updated>
  <entry>
    <id>tag:www.refactormycode.com,2007:Code38</id>
    <published>2007-10-01T09:58:22-07:00</published>
    <updated>2011-10-10T16:29:26-07:00</updated>
    <title>[JavaScript] Go Back To Yesterday</title>
    <content type="html">&lt;p&gt;Display yesterday's date.  Initially, what would happen on the first of every month, the day was displayed as &amp;quot;0&amp;quot; which was not acceptable.  This is what I came up with, but I'm not sure if there is a better way to do this in JavaScript.&lt;/p&gt;

&lt;pre&gt;   var d = new Date()
   d.setDate(d.getDate()-1)
   var yesterday = (d.getMonth()+1+&amp;quot;/&amp;quot;+d.getDate()+&amp;quot;/&amp;quot;+d.getFullYear())
   document.write(yesterday)&lt;/pre&gt;</content>
    <author>
      <name>https://getopenid.com/thegenericgeek</name>
      <email>no-email@refactormycode.com</email>
    </author>
    <link type="text/html" href="http://www.refactormycode.com/codes/38-go-back-to-yesterday" rel="alternate"/>
  </entry>
</feed>

