• Espruino Clock Module
    
     var Clock = require("clock").Clock;
      var clk=new Clock(2014,4,15,23,45,0,0);   // Initialise with specific date
      var clk=new Clock("Jun 23, 2014 12:18:02");   // ... or Initialise with specific date from a string
    
      // every time the button is pressed, print the current time..
      setWatch(function() {
        var d1=clk.getDate(); 
        print(d1.toString()); // prints "Thu May 15 2014 23:45:05" 
      }, BTN, { edge : "rising", repeat : true, debounce : 10 } );
    
      // You can also update the current time
      clk.setClock(Date.parse("Jun 23, 2014 12:18:02"));
    

    From above ...
    var clk=new Clock(2014,4,15,23,45,0,0); // Initialise with specific date
    print(d1.toString()); // prints "Thu May 15 2014 23:45:05"

    It does what it says BUT the number "4" for the month is April and 5 should be for May.
    Looks like someone started to use, for the months, 0-11 and not the normal 1-12?
    Are you going to keep the months index this way?

    Windows 8.1 64 Bit
    Chrome 35.0.1916.153 m (no beta)
    Espruino 1v69
    Web-IDE v 45
    Board: Espruino v 1.3

About

Avatar for user7114 @user7114 started