Javascript and working with dates

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rhaazy

    Javascript and working with dates

    I need to write some javascript that will return a date string in the
    form mm/dd/yyyy.

    The date needs to be today's date - 30 days.

    Is there a relatively straight forward way to do this?

    So far all I can find is a mess of variables for month, day, and year,
    and combining some date functions together, etc etc. Seems like a lot
    of work for what should be very simple.
  • SAM

    #2
    Re: Javascript and working with dates

    rhaazy a écrit :
    I need to write some javascript that will return a date string in the
    form mm/dd/yyyy.
    >
    The date needs to be today's date - 30 days.
    >
    Is there a relatively straight forward way to do this?

    So far all I can find is a mess of variables for month, day, and year,
    and combining some date functions together, etc etc. Seems like a lot
    of work for what should be very simple.

    and what do you think we have to do when we want the date in french ?
    dd/mm/yyyy

    var D = new Date();
    D.setMonth(D.ge tMonth()-1)
    alert( D.getDate()+'/'+(+D.getMonth( )+1)+'/'+D.getFullYear () );

    --19/8/2008

    --
    sm

    Comment

    • rhaazy

      #3
      Re: Javascript and working with dates

      On Sep 19, 3:04 pm, SAM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
      wrote:
      rhaazy a écrit :
      >
      I need to write some javascript that will return a date string in the
      form mm/dd/yyyy.
      >
      The date needs to be today's date - 30 days.
      >
      Is there a relatively straight forward way to do this?
      >

      >
      So far all I can find is a mess of variables for month, day, and year,
      and combining some date functions together, etc etc.  Seems like a lot
      of work for what should be very simple.
      >
      and what do you think we have to do when we want the date in french ?
        dd/mm/yyyy
      >
      var D = new Date();
      D.setMonth(D.ge tMonth()-1)
      alert( D.getDate()+'/'+(+D.getMonth( )+1)+'/'+D.getFullYear () );
      >
        --19/8/2008
      >
      --
      sm
      Thats fine if all I want is a date, but to be able to subtract 30 days
      from any given date introduces a huge mess of logic that needs to be
      coded.
      I decided to just find an open source date library that had decent
      parsing functions for my purpose.

      Thanks for the post.

      Comment

      • Joost Diepenmaat

        #4
        Re: Javascript and working with dates

        rhaazy <rhaazy@gmail.c omwrites:
        On Sep 19, 3:04 pm, SAM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
        wrote:
        Thats fine if all I want is a date, but to be able to subtract 30 days
        from any given date introduces a huge mess of logic that needs to be
        coded.
        That's because dates - and times - are VERY messy. A library able to
        manipulate dates that is complete enough to be /globally/ useful would
        be very large. See for example the amount of stuff in the perl DateTime
        project:


        I decided to just find an open source date library that had decent
        parsing functions for my purpose.
        If you can find a decent library, that's probably the best way to handle
        this problem.


        --
        Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

        Comment

        • Stevo

          #5
          Re: Javascript and working with dates

          rhaazy wrote:
          On Sep 19, 3:04 pm, SAM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
          wrote:
          >var D = new Date();
          >D.setMonth(D.g etMonth()-1)
          >alert( D.getDate()+'/'+(+D.getMonth( )+1)+'/'+D.getFullYear () );
          > --19/8/2008
          Thats fine if all I want is a date, but to be able to subtract 30 days
          from any given date introduces a huge mess of logic that needs to be
          coded.
          I can't recall any language that makes dealing with dates easy.

          Comment

          • Lasse Reichstein Nielsen

            #6
            Re: Javascript and working with dates

            rhaazy <rhaazy@gmail.c omwrites:
            I need to write some javascript that will return a date string in the
            form mm/dd/yyyy.
            >
            The date needs to be today's date - 30 days.
            >
            Is there a relatively straight forward way to do this?
            var date = new Date();
            date.setDate(da te.getDate()-30);
            var day = date.getDate();
            var mth = date.getMonth() ;
            var yr = date.getFullYea r();
            var format = (day < 10 ? "0" : "") + day + "/" +
            (mth < 10 ? "0" : "") + mth + "/" +
            yr;
            So far all I can find is a mess of variables for month, day, and year,
            and combining some date functions together, etc etc. Seems like a lot
            of work for what should be very simple.
            There isn't a date formatter built in. For most cases, it's not worth
            it anyway. Just make one function to format your dates as you want
            it and use that wherever it's needed.

            /L
            --
            Lasse Reichstein Nielsen
            DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
            'Faith without judgement merely degrades the spirit divine.'

            Comment

            • SAM

              #7
              Re: Javascript and working with dates

              rhaazy a écrit :
              On Sep 19, 3:04 pm, SAM <stephanemoriau x.NoAd...@wanad oo.fr.invalid>
              wrote:
              >rhaazy a écrit :
              >>
              >>I need to write some javascript that will return a date string in the
              >>form mm/dd/yyyy.
              >>The date needs to be today's date - 30 days.
              >>
              >var D = new Date();
              >D.setMonth(D.g etMonth()-1)
              >alert( D.getDate()+'/'+(+D.getMonth( )+1)+'/'+D.getFullYear () );
              >>
              > --19/8/2008
              >
              Thats fine if all I want is a date,
              don't you want date ? ("mm/dd/yyyy" you did say)
              but to be able to subtract 30 days
              and *absoloutly* 30 days ?
              from any given date introduces a huge mess of logic that needs to be
              coded.
              Example with a trap over February:
              =============== =============== ====
              var y = 2005, m = 03, d = 30; // 30/03/2005 (in dd/mm/yyyy)
              var D = new Date(y, +m-1, d); // the orginal JS date
              D.setDate(D.get Date()-30); // 30 days less
              // that is done
              alert( d+'/'+m+'/'+y+
              ' = original date\n'+
              D.getDate()+'/'+(+D.getMonth( )+1)+'/'+D.getFullYear ()+
              ' = date - 30 days'):


              --
              sm

              Comment

              • SAM

                #8
                Re: Javascript and working with dates

                Lasse Reichstein Nielsen a écrit :
                rhaazy <rhaazy@gmail.c omwrites:
                >>
                >The date needs to be today's date - 30 days.
                >>
                >Is there a relatively straight forward way to do this?
                >
                var date = new Date();
                date.setDate(da te.getDate()-30);
                var day = date.getDate();
                var mth = date.getMonth() ;
                months begin by '0' in JS. No ?
                so :
                var mth = +date.getMonth( )+1;
                var yr = date.getFullYea r();
                var format = (day < 10 ? "0" : "") + day + "/" +
                (mth < 10 ? "0" : "") + mth + "/" +
                yr;

                Comment

                • Conrad Lender

                  #9
                  Re: Javascript and working with dates

                  On 2008-09-20 00:30, Lasse Reichstein Nielsen wrote:
                  There isn't a date formatter built in. For most cases, it's not worth
                  it anyway. Just make one function to format your dates as you want
                  it and use that wherever it's needed.
                  Here's one simple way to retro-fit a date formatting method. It
                  implements a subset of formats from strftime(3); the PHP function of the
                  same name is also similar. Some of the formats are missing, like the
                  names of months, week days, etc, because they were not required when the
                  method was written. Note: some of the formats are different from what
                  you might expect - read the comments and adjust the code as you see fit.


                  Usage:
                  var d = new Date(2008, 3, 4);
                  var dstr1 = d.fmt("%m/%d/%Y");
                  var dstr2 = d.fmt("%d.%m.%Y ");


                  /* a simple date formatting method */
                  Date.prototype. fmt = function (format) {
                  var buffer = "";
                  var chr, nxt;
                  for (var i = 0, len = format.length; i < len; ++i) {
                  chr = format.substr(i , 1);
                  if (chr != "%") {
                  buffer += chr;
                  continue;
                  }
                  nxt = format.substr(i + 1, 1);
                  if (nxt == "C") { // 2-digit century (eg "19" or "20")
                  buffer += String(Math.flo or( /* this should be one line */
                  this.getFullYea r() / 100)).padFront( "0", 2);
                  } else if (nxt == "d") { // day of month (01 to 31)
                  buffer += String(this.get Date()).padFron t("0", 2);
                  } else if (nxt == "F") { // month of year (1 to 12)
                  buffer += (this.getMonth( ) + 1);
                  } else if (nxt == "f") { // day of month (1 to 31)
                  buffer += this.getDate();
                  } else if (nxt == "H") { // 24h hours (00 - 23)
                  buffer += String(this.get Hours()).padFro nt("0", 2);
                  } else if (nxt == "M") { // minutes (00 - 59)
                  buffer += String(this.get Minutes()).padF ront("0", 2);
                  } else if (nxt == "m") { // month of year (01 to 12)
                  buffer += String(this.get Month() + 1).padFront("0" , 2);
                  } else if (nxt == "n") { // newline
                  buffer += "\n";
                  } else if (nxt == "R") { // 24h time (%H:%M)
                  buffer += String(this.get Hours()).padFro nt("0", 2)
                  + ":"
                  + String(this.get Minutes()).padF ront("0", 2);
                  } else if (nxt == "S") { // seconds (00 - 59)
                  buffer += String(this.get Seconds()).padF ront("0", 2);
                  } else if (nxt == "T") { // 24h time (%H:%M:%S)
                  buffer += String(this.get Hours()).padFro nt("0", 2)
                  + ":"
                  + String(this.get Minutes()).padF ront("0", 2)
                  + ":"
                  + String(this.get Seconds()).padF ront("0", 2);
                  } else if (nxt == "Y") { // 4-digit year
                  buffer += this.getFullYea r();
                  } else if (nxt == "y") { // 2-digit year
                  var y = String(this.get FullYear());
                  buffer += y.substr(y.leng th -2, 2);
                  } else if (nxt == "%") { // literal "%" character
                  buffer += "%";
                  } else {
                  buffer += format.substr(i , 2);
                  }
                  ++i; // skip next
                  }
                  return buffer;
                  }


                  In this form, it also requires an extension to the String prototype object:

                  /* left-pads the string with {chr} until it is {len} characters long */
                  String.prototyp e.padFront = function (chr, len) {
                  if (this.length >= len) {
                  return this;
                  } else {
                  return chr.repeat(len - this.length) + this;
                  }
                  }

                  /* returns the string repeated {n} times */
                  String.prototyp e.repeat = function (n) {
                  if (n < 1) return "";
                  return (new Array(n + 1)).join(this);
                  }


                  If you don't like to mess with the native String and Date types, you
                  could refactor these methods as simple global methods (with date and
                  string arguments, respectively).


                  - Conrad

                  Comment

                  • sasuke

                    #10
                    Re: Javascript and working with dates

                    On Sep 20, 6:24 am, Conrad Lender <crlen...@yahoo .comwrote:
                    Usage:
                        var d = new Date(2008, 3, 4);
                        var dstr1 = d.fmt("%m/%d/%Y");
                        var dstr2 = d.fmt("%d.%m.%Y ");
                    >
                    /* a simple date formatting method */
                    Date.prototype. fmt = function (format) {
                        var buffer = "";
                        var chr, nxt;
                        for (var i = 0, len = format.length; i < len; ++i) {
                            chr = format.substr(i , 1);
                            if (chr != "%") {
                                buffer += chr;
                                continue;
                            }
                            nxt = format.substr(i + 1, 1);
                            if (nxt == "C") {           // 2-digit century (eg "19" or "20")
                                buffer += String(Math.flo or(   /* this shouldbe one line */
                                    this.getFullYea r() / 100)).padFront( "0", 2);
                            } else if (nxt == "d") {    // day of month (01 to 31)
                                buffer += String(this.get Date()).padFron t("0", 2);
                            } else if (nxt == "F") {    // month of year (1 to 12)
                                buffer += (this.getMonth( ) + 1);
                            } else if (nxt == "f") {    // day of month (1 to31)
                                buffer += this.getDate();
                            } else if (nxt == "H") {    // 24h hours (00 - 23)
                                buffer += String(this.get Hours()).padFro nt("0",2);
                            } else if (nxt == "M") {    // minutes (00 - 59)
                                buffer += String(this.get Minutes()).padF ront("0", 2);
                            } else if (nxt == "m") {    // month of year (01 to 12)
                                buffer += String(this.get Month() + 1).padFront("0" , 2);
                            } else if (nxt == "n") {    // newline
                                buffer += "\n";
                            } else if (nxt == "R") {    // 24h time (%H:%M)
                                buffer += String(this.get Hours()).padFro nt("0",2)
                                        + ":"
                                        + String(this.get Minutes()).padF ront("0", 2);
                            } else if (nxt == "S") {    // seconds (00 - 59)
                                buffer += String(this.get Seconds()).padF ront("0", 2);
                            } else if (nxt == "T") {    // 24h time (%H:%M:%S)
                                buffer += String(this.get Hours()).padFro nt("0",2)
                                        + ":"
                                        + String(this.get Minutes()).padF ront("0", 2)
                                        + ":"
                                        + String(this.get Seconds()).padF ront("0", 2);
                            } else if (nxt == "Y") {    // 4-digit year
                                buffer += this.getFullYea r();
                            } else if (nxt == "y") {    // 2-digit year
                                var y = String(this.get FullYear());
                                buffer += y.substr(y.leng th -2, 2);
                            } else if (nxt == "%") {    // literal "%" character
                                buffer += "%";
                            } else {
                                buffer += format.substr(i , 2);
                            }
                            ++i; // skip next
                        }
                        return buffer;
                    >
                    }
                    >
                    In this form, it also requires an extension to the String prototype object:
                    >
                    /* left-pads the string with {chr} until it is {len} characters long */
                    String.prototyp e.padFront = function (chr, len) {
                        if (this.length >= len) {
                            return this;
                        } else {
                            return chr.repeat(len - this.length) + this;
                        }
                    >
                    }
                    >
                    /* returns the string repeated {n} times */
                    String.prototyp e.repeat = function (n) {
                        if (n < 1) return "";
                        return (new Array(n + 1)).join(this);
                    >
                    }
                    Nice and compact implementation, 5 stars! A improvement here might be
                    using Array as buffer instead of String since Strings in Javascript
                    are immutable thereby preventing temporary string object creation.

                    /sasuke

                    Comment

                    • Thomas 'PointedEars' Lahn

                      #11
                      Re: Javascript and working with dates

                      sasuke wrote:
                      On Sep 20, 6:24 am, Conrad Lender <crlen...@yahoo .comwrote:
                      >Usage:
                      > var d = new Date(2008, 3, 4);
                      > var dstr1 = d.fmt("%m/%d/%Y");
                      > var dstr2 = d.fmt("%d.%m.%Y ");
                      >>
                      >/* a simple date formatting method */
                      >Date.prototype .fmt = function (format) {
                      > [50 lines of code]
                      >}
                      >>
                      >In this form, it also requires an extension to the String prototype object:
                      >>
                      >/* left-pads the string with {chr} until it is {len} characters long */
                      >String.prototy pe.padFront = function (chr, len) {
                      > if (this.length >= len) {
                      > return this;
                      > } else {
                      > return chr.repeat(len - this.length) + this;
                      > }
                      >>
                      >}
                      >>
                      >/* returns the string repeated {n} times */
                      >String.prototy pe.repeat = function (n) {
                      > if (n < 1) return "";
                      > return (new Array(n + 1)).join(this);
                      >>
                      >}
                      >
                      Nice and compact implementation, 5 stars!
                      Compact? Maybe String.prototyp e.padFront() and String.prototyp e.repeat().
                      A improvement here might be using Array as buffer instead of String
                      Or no user-defined buffer at all.
                      since Strings in Javascript are immutable thereby preventing temporary
                      string object creation.
                      Non sequitur.


                      PointedEars
                      --
                      Prototype.js was written by people who don't know javascript for people
                      who don't know javascript. People who don't know javascript are not
                      the best source of advice on designing systems that use javascript.
                      -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

                      Comment

                      • Thomas 'PointedEars' Lahn

                        #12
                        Re: Javascript and working with dates

                        Conrad Lender wrote:
                        On 2008-09-20 00:30, Lasse Reichstein Nielsen wrote:
                        >There isn't a date formatter built in. For most cases, it's not worth
                        >it anyway. Just make one function to format your dates as you want
                        >it and use that wherever it's needed.
                        >
                        Here's one simple way to retro-fit a date formatting method. It
                        implements a subset of formats from strftime(3); the PHP function of the
                        same name is also similar. Some of the formats are missing, like the
                        names of months, week days, etc, because they were not required when the
                        method was written. Note: some of the formats are different from what
                        you might expect - read the comments and adjust the code as you see fit.
                        [x] done
                        Usage:
                        var d = new Date(2008, 3, 4);
                        var dstr1 = d.fmt("%m/%d/%Y");
                        var dstr2 = d.fmt("%d.%m.%Y ");
                        >
                        >
                        /* a simple date formatting method */
                        Date.prototype. fmt = function (format) {
                        var buffer = "";
                        var chr, nxt;
                        for (var i = 0, len = format.length; i < len; ++i) {
                        chr = format.substr(i , 1);
                        if (chr != "%") {
                        buffer += chr;
                        continue;
                        }
                        nxt = format.substr(i + 1, 1);
                        if (nxt == "C") { // 2-digit century (eg "19" or "20")
                        buffer += String(Math.flo or( /* this should be one line */
                        this.getFullYea r() / 100)).padFront( "0", 2);
                        } else if (nxt == "d") { // day of month (01 to 31)
                        buffer += String(this.get Date()).padFron t("0", 2);
                        } else if (nxt == "F") { // month of year (1 to 12)
                        buffer += (this.getMonth( ) + 1);
                        } else if (nxt == "f") { // day of month (1 to 31)
                        buffer += this.getDate();
                        } else if (nxt == "H") { // 24h hours (00 - 23)
                        buffer += String(this.get Hours()).padFro nt("0", 2);
                        } else if (nxt == "M") { // minutes (00 - 59)
                        buffer += String(this.get Minutes()).padF ront("0", 2);
                        } else if (nxt == "m") { // month of year (01 to 12)
                        buffer += String(this.get Month() + 1).padFront("0" , 2);
                        } else if (nxt == "n") { // newline
                        buffer += "\n";
                        } else if (nxt == "R") { // 24h time (%H:%M)
                        buffer += String(this.get Hours()).padFro nt("0", 2)
                        + ":"
                        + String(this.get Minutes()).padF ront("0", 2);
                        } else if (nxt == "S") { // seconds (00 - 59)
                        buffer += String(this.get Seconds()).padF ront("0", 2);
                        } else if (nxt == "T") { // 24h time (%H:%M:%S)
                        buffer += String(this.get Hours()).padFro nt("0", 2)
                        + ":"
                        + String(this.get Minutes()).padF ront("0", 2)
                        + ":"
                        + String(this.get Seconds()).padF ront("0", 2);
                        } else if (nxt == "Y") { // 4-digit year
                        buffer += this.getFullYea r();
                        } else if (nxt == "y") { // 2-digit year
                        var y = String(this.get FullYear());
                        buffer += y.substr(y.leng th -2, 2);
                        } else if (nxt == "%") { // literal "%" character
                        buffer += "%";
                        } else {
                        buffer += format.substr(i , 2);
                        }
                        ++i; // skip next
                        }
                        return buffer;
                        }
                        Date.prototype. fmt = function(format ) {
                        var d = this;
                        return format.replace(/%([CdFfHMmnRSTYy%])/g,
                        function(m, p1) {
                        switch (p1)
                        {
                        case "C": return String(Math.flo or(d.getFullYea r() / 100))
                        .padFront("0", 2);
                        case "d": return String(d.getDat e()).padFront(" 0", 2);
                        case "F": return d.getMonth() + 1;
                        case "f": return d.getDate();
                        case "H": return String(d.getHou rs()).padFront( "0", 2);
                        case "M": return String(d.getMin utes()).padFron t("0", 2);
                        case "m": return String(d.getMon th() + 1).padFront("0" , 2);
                        case "n": return "\n";
                        case "R": return String(d.getHou rs()).padFront( "0", 2)
                        + ":"
                        + String(d.getMin utes()).padFron t("0", 2);
                        case "S": return String(d.getSec onds()).padFron t("0", 2);
                        case "T": return String(d.getHou rs()).padFront( "0", 2)
                        + ":"
                        + String(d.getMin utes()).padFron t("0", 2)
                        + ":"
                        + String(d.getSec onds()).padFron t("0", 2);
                        case "Y": return d.getFullYear() ;
                        case "y": return String(d.getFul lYear() % 100).padFront(" 0", 2);
                        default: return p1;
                        }
                        });
                        };


                        PointedEars
                        --
                        Anyone who slaps a 'this page is best viewed with Browser X' label on
                        a Web page appears to be yearning for the bad old days, before the Web,
                        when you had very little chance of reading a document written on another
                        computer, another word processor, or another network. -- Tim Berners-Lee

                        Comment

                        • Dr J R Stockton

                          #13
                          Re: Javascript and working with dates

                          On Sep 19, 4:12 pm, rhaazy <rha...@gmail.c omwrote:
                          I need to write some javascript that will return a date string in the
                          form mm/dd/yyyy.
                          Deprecanda est FFF.
                          The date needs to be today's date - 30 days.
                          Be aware that the user's date may differ from your date.
                          Is there a relatively straight forward way to do this?
                          D = new Date() ; D.setDate(D.get Date()-30)
                          with (D) X = String(10100000 0 + getMonth()*1e6 + getDate()*1e4 +
                          getFullYear())
                          .replace(/(.)(\d\d)(\d\d)/, "$2/$3/")
                          with (D) X = String(100 + getFullYear()*1 e4 + getMonth()*1e2 +
                          getDate())
                          .replace(/(\d{4})(\d\d)(\ d\d)/, "$2/$3/$1")

                          Only one of the with statements is required. This gives 2 2 4 digit
                          fields, unlike some.

                          --
                          (c) John Stockton, near London, UK. Posting with Google.
                          Mail: J.R.""""""""@ph ysics.org or (better) via Home Page at
                          Web: <URL:http://www.merlyn.demo n.co.uk/>
                          FAQish topics, acronyms, links, etc.; Date, Delphi, JavaScript, ...

                          Comment

                          • Conrad Lender

                            #14
                            Re: Javascript and working with dates

                            On 2008-09-20 13:03, Thomas 'PointedEars' Lahn wrote:
                            Date.prototype. fmt = function(format ) {
                            var d = this;
                            return format.replace(/%([CdFfHMmnRSTYy%])/g,
                            function(m, p1) {
                            switch (p1)
                            {
                            case "C": return String(Math.flo or(d.getFullYea r() / 100))
                            .padFront("0", 2);
                            case "d": return String(d.getDat e()).padFront(" 0", 2);
                            case "F": return d.getMonth() + 1;
                            case "f": return d.getDate();
                            case "H": return String(d.getHou rs()).padFront( "0", 2);
                            case "M": return String(d.getMin utes()).padFron t("0", 2);
                            case "m": return String(d.getMon th() + 1).padFront("0" , 2);
                            case "n": return "\n";
                            case "R": return String(d.getHou rs()).padFront( "0", 2)
                            + ":"
                            + String(d.getMin utes()).padFron t("0", 2);
                            case "S": return String(d.getSec onds()).padFron t("0", 2);
                            case "T": return String(d.getHou rs()).padFront( "0", 2)
                            + ":"
                            + String(d.getMin utes()).padFron t("0", 2)
                            + ":"
                            + String(d.getSec onds()).padFron t("0", 2);
                            case "Y": return d.getFullYear() ;
                            case "y": return String(d.getFul lYear() % 100).padFront(" 0", 2);
                            default: return p1;
                            }
                            });
                            };
                            Nice touch, thanks.

                            Performance is comparable, by the way: about the same in Opera and
                            Firefox2; the string buffer method is about 30% faster in Firefox3, and
                            the regex method is about 20% faster in IE7. Outside of benchmarks, the
                            performance difference is negligible, of course. I think I like your
                            approach better, it's more compact and easier to maintain.


                            - Conrad

                            Comment

                            • Conrad Lender

                              #15
                              Re: Javascript and working with dates

                              On 2008-09-20 09:43, sasuke wrote:
                              A improvement here might be using Array as buffer instead of String
                              That would be implementation dependant. After a quick check it looks
                              like an array buffer is actually a little slower in the browsers that
                              I've tested. IIRC, the speed difference between string concatenation and
                              array joins only favors the array if the substrings are rather long.


                              - Conrad

                              Comment

                              Working...