PHPackages                             sergiu-gordienco/javascript-date-format-object - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. sergiu-gordienco/javascript-date-format-object

ActiveLibrary

sergiu-gordienco/javascript-date-format-object
==============================================

1.0.3(11y ago)310JavaScript

Since Apr 6Pushed 11y agoCompare

[ Source](https://github.com/sergiu-gordienco/Javascript-Date-Format-Object)[ Packagist](https://packagist.org/packages/sergiu-gordienco/javascript-date-format-object)[ RSS](/packages/sergiu-gordienco-javascript-date-format-object/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

============================= Javascript-Date-Format-Object
===========================================================

[](#javascript-date-format-object)

Date and Time - Formatting a date or time in JavaScript

Examples of Use
---------------

[](#examples-of-use)

### Initialization

[](#initialization)

```

		// we initialize an object that use current time ( time when object m_date was created )
		var date_format	= m_date();

		document.write("");

		document.write("\n	Date: HH:mm:ss » "+m_date().format("H:i:s"));

		document.write("\n	Date: YYYY:MM:dd » "+m_date().format("Y:m:d"));

		document.write("");

```

### Using always the current time or changing IT

[](#using-always-the-current-time-or-changing-it)

```
	// initialization of object
	var date_format	= m_date();

	// renew current time in object
	m_date().setTime();
	// alert the current time
	alert(m_date.format("Y:m:d H:i:s"));

	// add a specific time **May 13 2012 13:45:20**
	m_date().setTime('2012 5 13 13:45:20');
	// alert updated time
	alert(m_date.format("Y:m:d H:i:s"));

	// a shorter mode to write
	alert(m_date.setTime('2012 5 13 13:45:20').format("Y:m:d H:i:s"));
```

### Relative time Changing

[](#relative-time-changing)

```
	// initialization of object
	var date_format	= m_date();

	// renew current time in object
	m_date().setTime();
	// alert the current time
	alert(m_date.format("Y:m:d H:i:s"));

	// add + 60 seconds
	m_date().setTime(60*1000);
	alert(m_date.format("Y:m:d H:i:s"));

	// now reducing + 120 seconds
	m_date().setTime(-120*1000);
	alert(m_date.format("Y:m:d H:i:s"));
```

### Escaping chars

[](#escaping-chars)

```
	// initialization of object
	var date_format	= m_date();

	// renew current time in object
	m_date().setTime();
	// alert the current time but,
	//	add a char "T" at the beginning of response
	alert(m_date.format("\\T Y:m:d H:i:s"));
```

### Changing Months Names

[](#changing-months-names)

```
	// initialization of object
	var date_format	= m_date();
	// change months names
	date_format.months	= [
		'Ianuarie','Februarie','Martie','Aprilie','Mai','Iunie',
		'Iulie','August','Septembrie','Octombrie','Noiembrie','Decembrie'];
	// alert the current month in short and long form
	alert(m_date.format("M F"));

	// change days names
	date_format.days	= [
		'Duminică','Luni ','Marti','Miercuri','Joi','Vineri','Sambata'];
	// alert the current month in short and long form
	alert(m_date.format("l D"));
```

Additional Configurations for Date Formating
--------------------------------------------

[](#additional-configurations-for-date-formating)

### Format

[](#format)

`The format of the outputted date string. See the formatting options below. There are also several predefined date constants that may be used instead, so for example DATE_RSS contains the format string 'D, d M Y H:i:s'.`

`The following characters are recognized in the format parameter string format character`

- Day
    - **d** - Day of the month, 2 digits with leading zeros 01 to 31
    - **D** - A textual representation of a day, three letters Mon through Sun
    - **j** - Day of the month without leading zeros 1 to 31
    - **l** - (lowercase 'L') A full textual representation of the day of the week Sunday through Saturday
    - **N** - ISO-8601 numeric representation of the day of the week; 1 (for Monday) through 7 (for Sunday)
    - **S** - English ordinal suffix for the day of the month, 2 characters st, nd, rd or th. Works well with j
    - **w** - Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday)
    - **z** - The day of the year (starting from 0) 0 through 365
- Week --- ---
    - **W** - ISO-8601 week number of year, weeks starting on Monday; Example: 42 (the 42nd week in the year)
- Month
    - **F** - A full textual representation of a month, such as January or March January through December
    - **m** - Numeric representation of a month, with leading zeros 01 through 12
    - **M** - A short textual representation of a month, three letters Jan through Dec
    - **n** - Numeric representation of a month, without leading zeros 1 through 12
    - **t** - Number of days in the given month 28 through 31
- Year
    - **L** - Whether it's a leap year 1 if it is a leap year, 0 otherwise.
    - **Y** - A full numeric representation of a year, 4 digits Examples: 1999 or 2003
    - **y** - A two digit representation of a year Examples: 99 or 03
- Time
    - **a** - Lowercase Ante meridiem and Post meridiem am or pm
    - **A** - Uppercase Ante meridiem and Post meridiem AM or PM
    - **B** - Swatch Internet time 000 through 999
    - **g** - 12-hour format of an hour without leading zeros 1 through 12
    - **G** - 24-hour format of an hour without leading zeros 0 through 23
    - **h** - 12-hour format of an hour with leading zeros 01 through 12
    - **H** - 24-hour format of an hour with leading zeros 00 through 23
    - **i** - Minutes with leading zeros 00 to 59
    - **s** - Seconds, with leading zeros 00 through 59
    - **u** - Microseconds
- Timezone
    - **O** - Difference to Greenwich time (GMT) in hours Example: +0200
    - **P** - Difference to Greenwich time (GMT) with colon between hours and minutes; Example: +02:00
    - **Z** - Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. -43200 through 50400
- Full Date/Time
    - **c** - ISO 8601 date; 2004-02-12T15:19:21+00:00
    - **r** - » RFC 2822 formatted date Example: Thu, 21 Dec 2000 16:01:07 +0200
    - **U** - Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)

Unrecognized characters in the format string will be printed as-is.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 63.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~16 days

Total

3

Last Release

4029d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d84c4decbacb12c952a8cfe25d2e4d48f8f3fea20724cd9a13550023d26fc06?d=identicon)[sergiu-gordienco](/maintainers/sergiu-gordienco)

---

Top Contributors

[![javascriptmd](https://avatars.githubusercontent.com/u/24190433?v=4)](https://github.com/javascriptmd "javascriptmd (7 commits)")[![sergiu-gordienco](https://avatars.githubusercontent.com/u/2892755?v=4)](https://github.com/sergiu-gordienco "sergiu-gordienco (4 commits)")

### Embed Badge

![Health badge](/badges/sergiu-gordienco-javascript-date-format-object/health.svg)

```
[![Health](https://phpackages.com/badges/sergiu-gordienco-javascript-date-format-object/health.svg)](https://phpackages.com/packages/sergiu-gordienco-javascript-date-format-object)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
