SlideShare a Scribd company logo
1 of 31
MOMENT.JS
OVERVIEW
_by Oleksii Prohonnyi
IN A NUTSHELL
IN A NUTSHELL
 Parse, validate, manipulate, and display dates in JavaScript.
 Version: 2.13.0
 Download: http://momentjs.com/downloads/moment.js
 See more: http://momentjs.com/docs/
INSTALLATION
INSTALLATION
 bower install moment --save # bower
 npm install moment --save # npm
 Install-Package Moment.js # NuGet
 spm install moment --save # spm
 meteor add momentjs:moment # meteor
 See more: http://momentjs.com/docs/
WHERE TO USE
WHERE TO USE
 Moment was designed to work both in the browser and in Node.js.
 All code should work in both of these environments, and all unit tests are run in
both of these environments.
 Currently the following browsers are used for the ci system:
 Chrome on Windows XP,
 IE 8, 9, and 10 on Windows 7,
 IE 11 on Windows 10,
 latest Firefox on Linux,
 and latest Safari on OSX 10.8 and 10.11.
 See more: http://momentjs.com/docs/#/use-it/
PARSING
PARSING: General
 Instead of modifying the native Date.prototype, Moment.js creates a
wrapper for the Date object. To get this wrapper object, simply call
moment() with one of the supported input types.
 The Moment prototype is exposed through moment.fn. If you want
to add your own functions, that is where you would put them.
 See more: http://momentjs.com/docs/#/parsing/
PARSING: Input types (1)
 ISO 8601 format String:
moment("1995-12-25")
 String + Format:
moment("12-25-1995", "MM-DD-YYYY")
 String + Formats:
moment("12-25-1995", ["MM-DD-YYYY", "YYYY-MM-DD"])
 Special Formats:
moment("2010-01-01T05:06:07", moment.ISO_8601)
PARSING: Input types (2)
 Object:
moment({hour:15, minute:10})
 Unix Timestamp:
moment(1318781876406) #milliseconds
moment.unix(1318781876) #seconds
 Date:
moment(new Date(2011, 9, 16))
 Array:
moment([2010, 6, 10])
GET/SET
GET/SET
 Moment.js uses overloaded getters and setters. You may be familiar
with this pattern from its use in jQuery.
 Calling these methods without parameters acts as a getter, and
calling them with a parameter acts as a setter
moment().milliseconds(1464949616694)
moment().milliseconds()
 See more: http://momentjs.com/docs/#/get-set/
MANIPULATION
MANIPULATION: General
 Once you have a Moment, you may want to manipulate it in some way.
 Moment.js uses the fluent interface pattern, also known as method chaining.
moment().add(7, 'days')
.subtract(1, 'months')
.year(2009)
.hours(0)
.minutes(0)
.seconds(0);
 See more: http://momentjs.com/docs/#/manipulating/
MANIPULATION: Operations
 Add
 Substract
 Start of time
 End of time
 Local
 UTC
 UTC Offset
MANIPULATION: Example
var d = moment([2010, 0, 31]); // Jan 31, 2010
d.add(1, 'months'); // Feb 28, 2010
d.startOf('year'); // Jan 1, 2010 12:00
d.utcOffset(); // -240
DISPLAY
DISPLAY: Formatting
 Format
 Time from now
 Time from X
 Time to now
 Time to X
 Calendar Time
 Difference
 Unix Timestamp (milliseconds)
 Unix Timestamp (seconds)
 Days in Month
 As Javascript Date
 As Array
 As JSON
 As ISO 8601 String
 As Object
 As String
 See more: http://momentjs.com/docs/#/displaying/
DISPLAY: Example
var d = moment([2007, 01, 29]);
d.fromNow(); // “9 years ago"
d.from([2007, 01, 30]); // "a day ago"
moment([2007, 0, 29]).toNow(); // in 9 years
I18N
I18N: General
 Moment.js has robust support for internationalization.
 You can load multiple locales and easily switch between them.
 In addition to assigning a global locale, you can assign a locale to a specific
moment.
moment.locale('fr');
moment(1316116057189).fromNow() // "il y a une heure"
moment.locale('en');
moment(1316116057189).fromNow() // "an hour ago"
 See more: http://momentjs.com/docs/#/i18n/
I18N: Locale definition
 By default, Moment.js comes with English locale strings. If you need other locales, you can load
them into Moment.js for later use.
 More details on each of the parts of the locale bundle can be found in the customization section.
moment.locale('fr', {
months :
"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_no
vembre_décembre".split("_"),
weekdaysMin : "Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),
meridiemParse: /PD|MD/,
isPM: function (input) {
return input.charAt(0) === 'M';
}
});
FEW MORE THINGS
UTC
 By default, moment parses and displays in local time.
 If you want to parse or display a moment in UTC, you can use
moment.utc() instead of moment().
moment.utc([2011, 0, 1, 8])
moment([2011, 0, 1, 8])
 See more: http://momentjs.com/docs/#/parsing/utc/
CREATION DATA
 After a moment object is created, all of the inputs can be accessed with
creationData() method:
moment("13-01-02", "YY-MM-DD", true).creationData() === {
input: "13-01-02",
format: "YY-MM-DD",
locale: Locale obj,
isUTC: false,
strict: true
}
 See more: http://momentjs.com/docs/#/parsing/creation-data/
QUERIES
 Is Before
 Is Same
 Is After
 Is Same or Before
 Is Same or After
 Is Between
 Is Daylight Saving Time
 Is DST Shifted
 Is Leap Year
 Is a Moment
 Is a Date
 See more: http://momentjs.com/docs/#/query/
CUSTOMIZATION
 Moment.js is very easy to customize. In general, you
should create a locale setting with your customizations.
moment.locale('en-my-settings', {
// customizations.
});
 See more: http://momentjs.com/docs/#/customization/
PLUGINS
 Strftime
 ISO Calendar
 Date Ranges
 Twix
 Twitter
 Jalaali Calendar
 MSDate
 Fiscal Quarters
 Precise Range
 Recur
 Parse Date Format
 Java DateFormat Parser
 Hijri Calendar
 Round
 Transform
 Taiwan Calendar
 See more: http://momentjs.com/docs/#/plugins/
THANK YOU FOR
ATTENTION
Oleksii Prohonnyi
facebook.com/oprohonnyi
linkedin.com/in/oprohonnyi

More Related Content

Viewers also liked

Front-end rich JavaScript application creation (Backbone.js)
Front-end rich JavaScript application creation (Backbone.js)Front-end rich JavaScript application creation (Backbone.js)
Front-end rich JavaScript application creation (Backbone.js)Oleksii Prohonnyi
 
Как создать сайт за 2 часа? (Wordpress)
Как создать сайт за 2 часа? (Wordpress)Как создать сайт за 2 часа? (Wordpress)
Как создать сайт за 2 часа? (Wordpress)Oleksii Prohonnyi
 
Conference DotJS 2015 Paris review
Conference DotJS 2015 Paris reviewConference DotJS 2015 Paris review
Conference DotJS 2015 Paris reviewOleksii Prohonnyi
 
Dive into Angular, part 3: Performance
Dive into Angular, part 3: PerformanceDive into Angular, part 3: Performance
Dive into Angular, part 3: PerformanceOleksii Prohonnyi
 
Разработка веб-сайта. Сайт. Зачем он?
Разработка веб-сайта. Сайт. Зачем он?Разработка веб-сайта. Сайт. Зачем он?
Разработка веб-сайта. Сайт. Зачем он?Oleksii Prohonnyi
 
Chorme devtools
Chorme devtoolsChorme devtools
Chorme devtools傑倫 鍾
 
Dive into Angular, part 1: Introduction
Dive into Angular, part 1: IntroductionDive into Angular, part 1: Introduction
Dive into Angular, part 1: IntroductionOleksii Prohonnyi
 
Chrome DevTools Awesome 10 Features +1
Chrome DevTools Awesome 10 Features +1Chrome DevTools Awesome 10 Features +1
Chrome DevTools Awesome 10 Features +1yoshikawa_t
 
Google Chrome DevTools features overview
Google Chrome DevTools features overviewGoogle Chrome DevTools features overview
Google Chrome DevTools features overviewOleksii Prohonnyi
 
JavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and LibrariesJavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and LibrariesOleksii Prohonnyi
 
Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Oleksii Prohonnyi
 
Code review process with JetBrains UpSource
Code review process with JetBrains UpSourceCode review process with JetBrains UpSource
Code review process with JetBrains UpSourceOleksii Prohonnyi
 

Viewers also liked (15)

Front-end rich JavaScript application creation (Backbone.js)
Front-end rich JavaScript application creation (Backbone.js)Front-end rich JavaScript application creation (Backbone.js)
Front-end rich JavaScript application creation (Backbone.js)
 
Как создать сайт за 2 часа? (Wordpress)
Как создать сайт за 2 часа? (Wordpress)Как создать сайт за 2 часа? (Wordpress)
Как создать сайт за 2 часа? (Wordpress)
 
Conference DotJS 2015 Paris review
Conference DotJS 2015 Paris reviewConference DotJS 2015 Paris review
Conference DotJS 2015 Paris review
 
Dive into Angular, part 3: Performance
Dive into Angular, part 3: PerformanceDive into Angular, part 3: Performance
Dive into Angular, part 3: Performance
 
Разработка веб-сайта. Сайт. Зачем он?
Разработка веб-сайта. Сайт. Зачем он?Разработка веб-сайта. Сайт. Зачем он?
Разработка веб-сайта. Сайт. Зачем он?
 
Chorme devtools
Chorme devtoolsChorme devtools
Chorme devtools
 
OpenLayer's basics
OpenLayer's basicsOpenLayer's basics
OpenLayer's basics
 
Dive into Angular, part 1: Introduction
Dive into Angular, part 1: IntroductionDive into Angular, part 1: Introduction
Dive into Angular, part 1: Introduction
 
Bower introduction
Bower introductionBower introduction
Bower introduction
 
Chrome DevTools Awesome 10 Features +1
Chrome DevTools Awesome 10 Features +1Chrome DevTools Awesome 10 Features +1
Chrome DevTools Awesome 10 Features +1
 
Google Chrome DevTools features overview
Google Chrome DevTools features overviewGoogle Chrome DevTools features overview
Google Chrome DevTools features overview
 
Introduction to D3.js
Introduction to D3.jsIntroduction to D3.js
Introduction to D3.js
 
JavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and LibrariesJavaScript Presentation Frameworks and Libraries
JavaScript Presentation Frameworks and Libraries
 
Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0Dive into Angular, part 4: Angular 2.0
Dive into Angular, part 4: Angular 2.0
 
Code review process with JetBrains UpSource
Code review process with JetBrains UpSourceCode review process with JetBrains UpSource
Code review process with JetBrains UpSource
 

Similar to Moment.js overview

Introduction to nodejs
Introduction to nodejsIntroduction to nodejs
Introduction to nodejsJames Carr
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopleffen
 
Javascript why what and how
Javascript why what and howJavascript why what and how
Javascript why what and howsureshpraja1234
 
Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 MinigamesSusan Gold
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteorSapna Upreti
 
Get started with meteor | designveloper software agency meteor prime partner
Get started with meteor | designveloper software agency   meteor prime partnerGet started with meteor | designveloper software agency   meteor prime partner
Get started with meteor | designveloper software agency meteor prime partnerDesignveloper
 
Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014Lou Sacco
 
Puppeteer - A web scraping & UI Testing Tool
Puppeteer - A web scraping & UI Testing ToolPuppeteer - A web scraping & UI Testing Tool
Puppeteer - A web scraping & UI Testing ToolMiki Lombardi
 
Startup Snapshot in Node.js
Startup Snapshot in Node.jsStartup Snapshot in Node.js
Startup Snapshot in Node.jsIgalia
 
JSR 310. New Date API in Java 8
JSR 310. New Date API in Java 8JSR 310. New Date API in Java 8
JSR 310. New Date API in Java 8Serhii Kartashov
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed AssafAhmed Assaf
 
MunichJS - node.js - from the beginning
MunichJS - node.js - from the beginningMunichJS - node.js - from the beginning
MunichJS - node.js - from the beginningRobert Prediger
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.jsChris Cowan
 
SPU gameplay
SPU gameplaySPU gameplay
SPU gameplaySlide_N
 

Similar to Moment.js overview (20)

NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Introduction to nodejs
Introduction to nodejsIntroduction to nodejs
Introduction to nodejs
 
Meteor
MeteorMeteor
Meteor
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Ng2 cli
Ng2 cliNg2 cli
Ng2 cli
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshop
 
Javascript why what and how
Javascript why what and howJavascript why what and how
Javascript why what and how
 
Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 Minigames
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Reactive application using meteor
Reactive application using meteorReactive application using meteor
Reactive application using meteor
 
Get started with meteor | designveloper software agency meteor prime partner
Get started with meteor | designveloper software agency   meteor prime partnerGet started with meteor | designveloper software agency   meteor prime partner
Get started with meteor | designveloper software agency meteor prime partner
 
Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014Meteor Meet-up San Diego December 2014
Meteor Meet-up San Diego December 2014
 
Puppeteer - A web scraping & UI Testing Tool
Puppeteer - A web scraping & UI Testing ToolPuppeteer - A web scraping & UI Testing Tool
Puppeteer - A web scraping & UI Testing Tool
 
Startup Snapshot in Node.js
Startup Snapshot in Node.jsStartup Snapshot in Node.js
Startup Snapshot in Node.js
 
JSR 310. New Date API in Java 8
JSR 310. New Date API in Java 8JSR 310. New Date API in Java 8
JSR 310. New Date API in Java 8
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
MunichJS - node.js - from the beginning
MunichJS - node.js - from the beginningMunichJS - node.js - from the beginning
MunichJS - node.js - from the beginning
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
 
SPU gameplay
SPU gameplaySPU gameplay
SPU gameplay
 
What is SObjectizer 5.5
What is SObjectizer 5.5What is SObjectizer 5.5
What is SObjectizer 5.5
 

More from Oleksii Prohonnyi

Dive into Angular, part 2: Architecture
Dive into Angular, part 2: ArchitectureDive into Angular, part 2: Architecture
Dive into Angular, part 2: ArchitectureOleksii Prohonnyi
 
Front-end development introduction (JavaScript). Part 2
Front-end development introduction (JavaScript). Part 2Front-end development introduction (JavaScript). Part 2
Front-end development introduction (JavaScript). Part 2Oleksii Prohonnyi
 
Front-end development introduction (HTML, CSS). Part 1
Front-end development introduction (HTML, CSS). Part 1Front-end development introduction (HTML, CSS). Part 1
Front-end development introduction (HTML, CSS). Part 1Oleksii Prohonnyi
 
Test-driven development & Behavior-driven development basics
Test-driven development & Behavior-driven development basicsTest-driven development & Behavior-driven development basics
Test-driven development & Behavior-driven development basicsOleksii Prohonnyi
 
JavaScript Coding Guidelines
JavaScript Coding GuidelinesJavaScript Coding Guidelines
JavaScript Coding GuidelinesOleksii Prohonnyi
 
Database Optimization (MySQL)
Database Optimization (MySQL)Database Optimization (MySQL)
Database Optimization (MySQL)Oleksii Prohonnyi
 
Usability of UI Design (motivation, heuristics, tools)
Usability of UI Design (motivation, heuristics, tools)Usability of UI Design (motivation, heuristics, tools)
Usability of UI Design (motivation, heuristics, tools)Oleksii Prohonnyi
 

More from Oleksii Prohonnyi (9)

Dive into Angular, part 2: Architecture
Dive into Angular, part 2: ArchitectureDive into Angular, part 2: Architecture
Dive into Angular, part 2: Architecture
 
BEM methodology overview
BEM methodology overviewBEM methodology overview
BEM methodology overview
 
Front-end development introduction (JavaScript). Part 2
Front-end development introduction (JavaScript). Part 2Front-end development introduction (JavaScript). Part 2
Front-end development introduction (JavaScript). Part 2
 
Front-end development introduction (HTML, CSS). Part 1
Front-end development introduction (HTML, CSS). Part 1Front-end development introduction (HTML, CSS). Part 1
Front-end development introduction (HTML, CSS). Part 1
 
Test-driven development & Behavior-driven development basics
Test-driven development & Behavior-driven development basicsTest-driven development & Behavior-driven development basics
Test-driven development & Behavior-driven development basics
 
JavaScript Coding Guidelines
JavaScript Coding GuidelinesJavaScript Coding Guidelines
JavaScript Coding Guidelines
 
Database Optimization (MySQL)
Database Optimization (MySQL)Database Optimization (MySQL)
Database Optimization (MySQL)
 
PHPCS (PHP Code Sniffer)
PHPCS (PHP Code Sniffer)PHPCS (PHP Code Sniffer)
PHPCS (PHP Code Sniffer)
 
Usability of UI Design (motivation, heuristics, tools)
Usability of UI Design (motivation, heuristics, tools)Usability of UI Design (motivation, heuristics, tools)
Usability of UI Design (motivation, heuristics, tools)
 

Recently uploaded

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 

Recently uploaded (20)

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 

Moment.js overview

  • 3. IN A NUTSHELL  Parse, validate, manipulate, and display dates in JavaScript.  Version: 2.13.0  Download: http://momentjs.com/downloads/moment.js  See more: http://momentjs.com/docs/
  • 5. INSTALLATION  bower install moment --save # bower  npm install moment --save # npm  Install-Package Moment.js # NuGet  spm install moment --save # spm  meteor add momentjs:moment # meteor  See more: http://momentjs.com/docs/
  • 7. WHERE TO USE  Moment was designed to work both in the browser and in Node.js.  All code should work in both of these environments, and all unit tests are run in both of these environments.  Currently the following browsers are used for the ci system:  Chrome on Windows XP,  IE 8, 9, and 10 on Windows 7,  IE 11 on Windows 10,  latest Firefox on Linux,  and latest Safari on OSX 10.8 and 10.11.  See more: http://momentjs.com/docs/#/use-it/
  • 9. PARSING: General  Instead of modifying the native Date.prototype, Moment.js creates a wrapper for the Date object. To get this wrapper object, simply call moment() with one of the supported input types.  The Moment prototype is exposed through moment.fn. If you want to add your own functions, that is where you would put them.  See more: http://momentjs.com/docs/#/parsing/
  • 10. PARSING: Input types (1)  ISO 8601 format String: moment("1995-12-25")  String + Format: moment("12-25-1995", "MM-DD-YYYY")  String + Formats: moment("12-25-1995", ["MM-DD-YYYY", "YYYY-MM-DD"])  Special Formats: moment("2010-01-01T05:06:07", moment.ISO_8601)
  • 11. PARSING: Input types (2)  Object: moment({hour:15, minute:10})  Unix Timestamp: moment(1318781876406) #milliseconds moment.unix(1318781876) #seconds  Date: moment(new Date(2011, 9, 16))  Array: moment([2010, 6, 10])
  • 13. GET/SET  Moment.js uses overloaded getters and setters. You may be familiar with this pattern from its use in jQuery.  Calling these methods without parameters acts as a getter, and calling them with a parameter acts as a setter moment().milliseconds(1464949616694) moment().milliseconds()  See more: http://momentjs.com/docs/#/get-set/
  • 15. MANIPULATION: General  Once you have a Moment, you may want to manipulate it in some way.  Moment.js uses the fluent interface pattern, also known as method chaining. moment().add(7, 'days') .subtract(1, 'months') .year(2009) .hours(0) .minutes(0) .seconds(0);  See more: http://momentjs.com/docs/#/manipulating/
  • 16. MANIPULATION: Operations  Add  Substract  Start of time  End of time  Local  UTC  UTC Offset
  • 17. MANIPULATION: Example var d = moment([2010, 0, 31]); // Jan 31, 2010 d.add(1, 'months'); // Feb 28, 2010 d.startOf('year'); // Jan 1, 2010 12:00 d.utcOffset(); // -240
  • 19. DISPLAY: Formatting  Format  Time from now  Time from X  Time to now  Time to X  Calendar Time  Difference  Unix Timestamp (milliseconds)  Unix Timestamp (seconds)  Days in Month  As Javascript Date  As Array  As JSON  As ISO 8601 String  As Object  As String  See more: http://momentjs.com/docs/#/displaying/
  • 20. DISPLAY: Example var d = moment([2007, 01, 29]); d.fromNow(); // “9 years ago" d.from([2007, 01, 30]); // "a day ago" moment([2007, 0, 29]).toNow(); // in 9 years
  • 21. I18N
  • 22. I18N: General  Moment.js has robust support for internationalization.  You can load multiple locales and easily switch between them.  In addition to assigning a global locale, you can assign a locale to a specific moment. moment.locale('fr'); moment(1316116057189).fromNow() // "il y a une heure" moment.locale('en'); moment(1316116057189).fromNow() // "an hour ago"  See more: http://momentjs.com/docs/#/i18n/
  • 23. I18N: Locale definition  By default, Moment.js comes with English locale strings. If you need other locales, you can load them into Moment.js for later use.  More details on each of the parts of the locale bundle can be found in the customization section. moment.locale('fr', { months : "janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_no vembre_décembre".split("_"), weekdaysMin : "Di_Lu_Ma_Me_Je_Ve_Sa".split("_"), meridiemParse: /PD|MD/, isPM: function (input) { return input.charAt(0) === 'M'; } });
  • 25. UTC  By default, moment parses and displays in local time.  If you want to parse or display a moment in UTC, you can use moment.utc() instead of moment(). moment.utc([2011, 0, 1, 8]) moment([2011, 0, 1, 8])  See more: http://momentjs.com/docs/#/parsing/utc/
  • 26. CREATION DATA  After a moment object is created, all of the inputs can be accessed with creationData() method: moment("13-01-02", "YY-MM-DD", true).creationData() === { input: "13-01-02", format: "YY-MM-DD", locale: Locale obj, isUTC: false, strict: true }  See more: http://momentjs.com/docs/#/parsing/creation-data/
  • 27. QUERIES  Is Before  Is Same  Is After  Is Same or Before  Is Same or After  Is Between  Is Daylight Saving Time  Is DST Shifted  Is Leap Year  Is a Moment  Is a Date  See more: http://momentjs.com/docs/#/query/
  • 28. CUSTOMIZATION  Moment.js is very easy to customize. In general, you should create a locale setting with your customizations. moment.locale('en-my-settings', { // customizations. });  See more: http://momentjs.com/docs/#/customization/
  • 29. PLUGINS  Strftime  ISO Calendar  Date Ranges  Twix  Twitter  Jalaali Calendar  MSDate  Fiscal Quarters  Precise Range  Recur  Parse Date Format  Java DateFormat Parser  Hijri Calendar  Round  Transform  Taiwan Calendar  See more: http://momentjs.com/docs/#/plugins/