A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.telerik.com/kendo-vue-ui/components/datemath/date-calculations below:

Vue Date Math Date Calculations

New to Kendo UI for Vue? Start a free 30-day trial Date Calculations

The Date Math package provides options for adding and removing specific time periods (for example, days and weeks), getting the first or last time periods (for example, the first date in a month), and also creating dates and comparing dates.

Adding and Removing Time Periods Days

To add or remove a conditional number of days from a Date object, use the addDays method.

import { addDays } from '@progress/kendo-date-math';

const date = new Date(2000, 10, 10);
const newDate = addDays(date, 10); 
Weeks

To add or remove a conditional number of weeks from a Date object, use the addWeeks method.

import { addWeeks } from '@progress/kendo-date-math';

const date = new Date(2000, 10, 10);
const newDate = addWeeks(date, 10); 
Months

To add or remove a conditional number of months from a Date object, use the addMonths method.

import { addMonths } from '@progress/kendo-date-math';

const date = new Date(2000, 10, 10);
const newDate = addMonths(date, 10); 
Years

To add or remove a conditional number of years from a Date object, use the addYears method.

import { addYears } from '@progress/kendo-date-math';

const date = new Date(2000, 10, 10);
const newDate = addYears(date, 10); 
Decades

To add or remove a conditional number of decades from a Date object, use the addDecades method.

import { addDecades } from '@progress/kendo-date-math';

const date = new Date(2000, 10, 10);
const newDate = addDecades(date, 10); 
Centuries

To add or remove a conditional number of centuries from a Date object, use the addCenturies method.

import { addCenturies } from '@progress/kendo-date-math';

const date = new Date(2000, 10, 10);
const newDate = addCenturies(date, 10); 
Getting First or Last Time Periods First and Last Dates in Months

To get the first and last dates from a Date object, use the firstDayOfMonth and lastDayOfMonth functions respectively.

import { firstDayOfMonth, lastDayOfMonth } from '@progress/kendo-date-math';

const date = new Date(2000, 10, 10);
const firstDay = firstDayOfMonth(date); 
const lastDay = lastDayOfMonth(date); 
First and Last Months in Years

To get the first and last months from a Date object, use the firstMonthOfYear and lastMonthOfYear functions respectively.

import { firstMonthOfYear, lastMonthOfYear } from '@progress/kendo-date-math';

const date = new Date(2000, 10, 10);
const firstDay = firstMonthOfYear(date); 
const lastDay = lastMonthOfYear(date); 
First and Last Years in Decades

To get the first and last years from a Date object, use the firstYearOfDecade and lastYearOfDecade functions respectively.

import { firstYearOfDecade, lastYearOfDecade } from '@progress/kendo-date-math';

const date = new Date(2005, 10, 10);
const firstDay = firstYearOfDecade(date); 
const lastDay = lastYearOfDecade(date); 
First and Last Decades in Centuries

To get the first and last decades from a Date object, use the firstDecadeOfCentury and lastDecadeOfCentury functions respectively.

import { firstDecadeOfCentury, lastDecadeOfCentury } from '@progress/kendo-date-math';

const date = new Date(2020, 10, 10);
const firstDay = firstDecadeOfCentury(date); 
const lastDay = lastDecadeOfCentury(date); 
Getting Durations and Specific Time Periods Next and Previous Dates in Weeks

To get the next and previous dates in a week based on a week day number, use the nextDayOfWeek and prevDayOfWeek functions respectively.

import { Day, prevDayOfWeek, nextDayOfWeek } from '@progress/kendo-date-math';

const nextDate = nextDayOfWeek(new Date(2016, 0, 1), Day.Wednesday); 
const prevDate = prevDayOfWeek(new Date(2016, 0, 1), Day.Wednesday); 
Week Numbers in Years

To calculate the week number, based on a given date, use the weekInYear function.

import { weekInYear } from '@progress/kendo-date-math';

const date = new Date(2000, 10, 10);
const weekNumber = weekInYear(date); 
Date Ranges in Months

To get the duration in months between two Date objects, use the durationInMonths function.

import { durationInMonths } from '@progress/kendo-date-math';

const start = new Date(2020, 1, 20);
const end = new Date(2020, 10, 4);
const duration = durationInMonths(start, end); 
Date Ranges in Years

To get the duration in years between two Date objects, use the durationInYears function.

import { durationInYears } from '@progress/kendo-date-math';

const start = new Date(2015, 1, 20);
const end = new Date(2020, 10, 4);
const duration = durationInYears(start, end); 
Date Ranges in Decades

To get the duration in decades between two Date objects, use the durationInDecades function.

import { durationInDecades } from '@progress/kendo-date-math';

const start = new Date(2000, 1, 20);
const end = new Date(2020, 10, 4);
const duration = durationInDecades(start, end); 
Date Ranges in Centuries

To get the centuries in decades between two Date objects, use the durationInCenturies function.

import { durationInCenturies } from '@progress/kendo-date-math';

const start = new Date(2000, 1, 20);
const end = new Date(2300, 10, 4);
const duration = durationInCenturies(start, end); 
Date Part

To get only the date part of a Date instance, use the getDate function.

import { getDate } from '@progress/kendo-date-math';

const date = new Date(2000, 10, 10, 22, 30);
const datePart = getDate(date); 
Creating Dates

To create a date with year value below 100, use the createDate function.

import { createDate } from '@progress/kendo-date-math';

createDate(16, 0, 15); 
createDate(2016, 0, 15); 
createDate(2016, 0, 15, 22, 22, 20); 
Comparing Dates Date and Time Portions

To compare the date and time portions of the date instance of two dates, use isEqual function.

import { isEqual } from '@progress/kendo-date-math';

const date1 = new Date(2000, 10, 10);
const date2 = new Date(2000, 10, 10, 10);
const equal = isEqual(date1, date2); 
Date-Only Portions

To compare only the date portions of the date instance of two dates, use the isEqualDate function.

import { isEqualDate } from '@progress/kendo-date-math';

const date1 = new Date(2000, 10, 10);
const date2 = new Date(2000, 10, 10, 10);
const equal = isEqualDate(date1, date2); 
Suggested Links

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4