WAT JavaScript Date

C4ce16f549c450f4759eb37f5d5d1a63?s=47 othree
August 10, 2017

WAT JavaScript Date

C4ce16f549c450f4759eb37f5d5d1a63?s=128

othree

August 10, 2017
Tweet

Transcript

  1. 5.

    “Wat” is a variant of the English word “what” that

    is often used to express confusion or disgust, much like its better known acronym “WTF,” short for “what the fuck.” http://knowyourmeme.com/memes/wat
  2. 8.
  3. 9.
  4. 10.
  5. 11.
  6. 12.
  7. 13.
  8. 14.
  9. 15.
  10. 22.
  11. 23.

    // Firefox latest new Date("2005-07-08"); // Date 2005-07-08T00:00:00.000Z // July

    8th 00:00 UTC new Date("2005/07/08"); // Date 2005-07-07T16:00:00.000Z // July 8th 00:00 local time
  12. 24.

    // Firefox latest new Date("2005-07-08"); // Date 2005-07-08T00:00:00.000Z // July

    8th 00:00 UTC new Date("2005/07/08"); // Date 2005-07-07T16:00:00.000Z // July 8th 00:00 local time (Date.parse("2005-07-08") - Date.parse("2005/07/08")) / 36e5 // 8 hours
  13. 25.

    // Firefox latest new Date("2005-07-08"); // Date 2005-07-08T00:00:00.000Z // July

    8th 00:00 UTC new Date("2005/07/08"); // Date 2005-07-07T16:00:00.000Z // July 8th 00:00 local time (Date.parse("2005-07-08") - Date.parse("2005/07/08")) / 36e5 // 8 hours // Chrome latest new Date("2005-07-08");
  14. 26.

    // Firefox latest new Date("2005-07-08"); // Date 2005-07-08T00:00:00.000Z // July

    8th 00:00 UTC new Date("2005/07/08"); // Date 2005-07-07T16:00:00.000Z // July 8th 00:00 local time (Date.parse("2005-07-08") - Date.parse("2005/07/08")) / 36e5 // 8 hours // Chrome latest new Date("2005-07-08"); // Fri Jul 08 2005 08:00:00 GMT+0800 (CST) // July 8th 00:00 local time
  15. 27.
  16. 29.

    // Firefox var theday = new Date(2017, 2, 3, 0,

    0, 0, 0); // Date 2017-03-02T16:00:00.000Z
  17. 30.
  18. 31.

    // Firefox var theday = new Date(2017, 2, 3, 0,

    0, 0, 0); // Date 2017-03-02T16:00:00.000Z // 2 -> March, 0 based
  19. 32.

    // Firefox var theday = new Date(2017, 2, 3, 0,

    0, 0, 0); // Date 2017-03-02T16:00:00.000Z // 2 -> March, 0 based // UTC Time: 03/02 16:00 // UTC+8 Time: 03/03 00:00
  20. 33.

    // Firefox var theday = new Date(2017, 2, 3, 0,

    0, 0, 0); // Date 2017-03-02T16:00:00.000Z // 2 -> March, 0 based // UTC Time: 03/02 16:00 // UTC+8 Time: 03/03 00:00 theday.getDate() // 3 theday.getUTCDate() // 2
  21. 34.

    // Firefox var theday = new Date(2017, 2, 3, 0,

    0, 0, 0); // Date 2017-03-02T16:00:00.000Z // 2 -> March, 0 based // UTC Time: 03/02 16:00 // UTC+8 Time: 03/03 00:00 theday.getDate() // 3 theday.getUTCDate() // 2 new Date(2017, 2, 3, 8, 0, 0, 0); // Date 2017-03-03T00:00:00.000Z
  22. 35.

    // Firefox var theday = new Date(2017, 2, 3, 0,

    0, 0, 0); // Date 2017-03-02T16:00:00.000Z // 2 -> March, 0 based // UTC Time: 03/02 16:00 // UTC+8 Time: 03/03 00:00 theday.getDate() // 3 theday.getUTCDate() // 2 new Date(2017, 2, 3, 8, 0, 0, 0); // Date 2017-03-03T00:00:00.000Z new Date(Date.UTC(2017, 2, 3, 8, 0, 0, 0)); // Date 2017-03-03T08:00:00.000Z
  23. 38.
  24. 39.

    [[_?[ 㗢 Y?CSYG6Q;6M?Q=6YSQMh 㗢 _]69M?㗦 SSY =?[GCQ 㗢 㖍96[?=OSQ]E 㗢

    *Q?fU?;]?=U6Y[?Y9?E6aGSY 㗢 S(GO?4SQ?6Q=&([_UUSY] 㗢 S=_Y6]GSQ㗦U?YGS=
  25. 51.

    // momentjs var thedate = moment("20170131", "YYYYMMDD"); thedate.add(2, 'months').format(); //

    "2017-03-31T00:00:00+08:00" thedate.add(1, 'months').add(1, 'months').format();
  26. 52.

    // momentjs var thedate = moment("20170131", "YYYYMMDD"); thedate.add(2, 'months').format(); //

    "2017-03-31T00:00:00+08:00" thedate.add(1, 'months').add(1, 'months').format(); // "2017-03-28T00:00:00+08:00"
  27. 53.

    // momentjs var thedate = moment("20170131", "YYYYMMDD"); thedate.add(2, 'months').format(); //

    "2017-03-31T00:00:00+08:00" thedate.add(1, 'months').add(1, 'months').format(); // "2017-03-28T00:00:00+08:00" thedate.add(1, 'months').format(); // "2017-02-28T00:00:00+08:00"
  28. 67.
  29. 69.
  30. 71.
  31. 74.
  32. 77.

    var thedate = LocalDate.parse('2017-01-31').atStartOfDay(); var after2m = thedate.plusMonths(2); after2m.toString(); //

    "2017-03-31T00:00" var sixtydays = Duration.ofDays(60); thedate.plus(sixtydays).toString(); // "2017-04-01T00:00" ZonedDateTime.now(ZoneId.of('Europe/Paris')).toString(); // "2017-02-04T17:01:15.846+01:00[Europe/Paris]"
  33. 78.
  34. 82.
  35. 83.

    ]?OUSY6M 㗢 ?dUYSUS[6M 㗢 S=6MGK? =?[GCQ 㗢 6CCG? GQ]㘵G;YS[SA]㘸 㗢

    6]]SEQ[SQ㘵G;YS[SA]㗦6_]ESYSASO?Q]㗿I[㘸 㗢 YG6Q(?YM[SQ㘵G;YS[SA]㘸
  36. 88.

    var ldt = new temporal.LocalDateTime(2017, 12, 31, 23, 59); var

    addHours = new temporal.LocalDateTime( 2017, 12, 31, 23, 00).add(2, 'hours'); var zdt = new temporal.ZonedDateTime('America/New_York', 2017, 12, 31, 23, 59);
  37. 89.

    var ldt = new CivilDateTime(2017, 12, 31, 23, 59); var

    addHours = new CivilDateTime(2017, 12, 31, 23, 00) .add(2, 'hours'); var zdt = ldt.withZone(‘America/New_York');
  38. 91.