Moment.php

Wrapper for PHP's DateTime class inspired by moment.js

1. DateTime from "Now" (UTC)

{{test01}}

2. Set date and add 2 hours

Date: 15.05.2012 12:30:00 (CET)

{{test02}}

3. Set date and subtract 7 days and 15 minutes

Date: 15.05.2012 12:30:00 (CET)

{{test03}}

4. Difference between two dates

Date#1: 12.05.2012 / 15:00:00 (UTC)

Date#2: 25.09.2011 / 10:00:00 (UTC)

Difference seconds: {{test04.01}}

Difference in minutes: {{test04.02}}

Difference in hours: {{test04.03}}

Difference in days: {{test04.04}}

Difference in weeks: {{test04.05}}

5. Difference Date#1 to "Now"

Date#1: 01.02.2013 / 07:00:00 (UTC)

Difference seconds: {{test05.01}}

Difference in minutes: {{test05.02}}

Difference in hours: {{test05.03}}

Difference in days: {{test05.04}}

Difference in weeks: {{test05.05}}

6. CET to UTC

CET: {{test06.01}}

UTC: {{test06.02}}

7. Custom format

{{test07}}

8. Get period

Get the period week for the date: {{test08.03}}

Week starts on: {{test08.01}}

Week ends on: {{test08.02}}

9. Use other format definitions via FormatsInterface

Reference date '2012-04-25T03:00:00' in 'CET'.

Moment.php "l, F jS Y g:i A" {{test09.01}}

Moment.js "LLLL" {{test09.02}}