Manuals/calci/MOMENT

From ZCubes Wiki
Revision as of 02:27, 17 February 2020 by Devika (talk | contribs) (→‎Description)
Jump to navigation Jump to search
MOMENT()


Description

  • This function shows the current date and time.
  • MOMENT is used to display the present date and time in Greenwich mean time which is called GMT time.
  • UK time is GMT only during the winter months.
  • MOMENT() gives the current date and time, also converts the current date and time to the specified format.
  • Here it formats a date as a four digit year, followed by a space, followed by a two digit month, another space, and a two digit date.
  • Using MOMENT(),we can do multiple items.
Function Description
moment().format('MMMM Do YYYY, h:mm:ss a') Shows current date and time
moment().format('dddd'); Shows the current day
moment().format("MMM Do YY") Shows current month and Year
moment().format('YYYY [escaped] YYYY') Current Year
moment().format() shows yyyy,mm,dd and time format
Function Description
moment("20111031", "YYYYMMDD").fromNow() 8 years ago
moment("20120620", "YYYYMMDD").fromNow() 8 years ago
moment().startOf('day').fromNow() 13 years ago
moment().endOf('day').fromNow() in 11 hours
moment().startOf('hour').fromNow() 23 minutes ago
Function Description
moment().subtract(10, 'days').calendar() Subtract 10 days from today
moment().subtract(6, 'days').calendar() Subtract 6 days from today
moment().subtract(3, 'days').calendar() Subtract 3 days from today
moment().subtract(1, 'days').calendar() Subtract 1 day from today
moment().calendar(); Today current time
moment().add(1, 'days').calendar() Add 1 day from today
moment().add(3, 'days').calendar() Add 3 days from today
moment().add(10, 'days').calendar() Add 10 days from today
Function Description
moment.locale() en
moment().format('LT') Current Time with hour and Minute
moment().format('LTS') Current Time with hour, minute and second

Examples

  1. MOMENT() = "2018-05-24T18:54:09.484Z"
  2. MOMENT().subtract(23,"days") = "2018-05-01T18:54:54.421Z"
  3. MOMENT().subtract(INTERVAL(24,"days")) = "2018-04-30T18:55:33.409Z"


Related Videos

Moment

See Also

References