r1 - 27 Dec 2005 - 06:41:32 - SooGuanYou are here: TWiki >  Main Web  >  ElixirEnsemble > ElixirEnsembleCookbook > SampleScriptForDateHandling
Some sample script for DateHandling?

Date.js

function getMonth(Date)
{
   return Date.getMonth();
}

function getYear(Date)
{
   return Date.getYear();
}

function getFullYear(Date)
{
   return Date.getFullYear();
}

function getQuarter(Date)
{
   switch (Date.getMonth())
   {
      case >8: return 1;
      case >5: return 2;
      case >2: return 3;
      default: return 4;
   }
}

function getDate(Date)
{
   return Date.getDate();
}

function getDay(Date)
{
   return Date.getDay();
}

function getFullDay(Date)
{
   switch (Date.getDay())
   {
      case 0: return "Sunday";
      case 1: return "Monday";
      case 2: return "Tuesday";
      case 3: return "Wednesday";
      case 4: return "Thursday";
      case 5: return "Friday";
      case 6: return "Saturday";
      default: return "";
   }
}

function getHours(Date)
{
   return Date.getHours();
}

function getMinutes(Date)
{
   return Date.getMinutes();
}

function getSeconds(Date)
{
   return Date.getSeconds();
}
-- SooGuan - 27 Dec 2005
Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback