Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Date
<script src="cromag.min.js"></script>
<script>
var now = new Cromag();
console.log(now.toString());
</script>
$ npm install cromag
var Cromag = require('cromag');
var now = new Cromag();
console.log(now.toString());
Creates a Cromag
instance which allows you to work with dates and times.
new Cromag()
new Cromag(milliseconds)
new Cromag(dateString)
new Cromag(year, month, day [, hour, minute, second, millisecond ])
milliseconds - Number
representing the number of milliseconds since 1 January 1970 00:00:00 UTC
dateString - String
value representing a date
year - Number
representing the year
month - Number
representing the month, 0
for January
through 11
for December
day - Number
representing the day of the month 1-31
hour - Number
representing the hour of the day 0-23
minute - Number
representing the minute of the hour 0-59
second - Number
representing the second of the minute 0-59
millisecond - Number
representing the millisecond 0-999
Returns the number of milliseconds
of the current time. Equivalent to +new Cromag()
or new Cromag().valueOf()
Cromag.now()
Returns the number of milliseconds
of the time passed as dateString
.
Cromag.parse(dateString)
Cromag.parse(dateString, format)
dateString - String
value representing a date
format - String
representing a date format
Returns the number of milliseconds
representing universal time for the parameters provided. These parameters are the same as the long form of the constructor
.
Cromag.UTC(year, month, day)
Cromag.UTC(year, month, day, hour)
Cromag.UTC(year, month, day, hour, minute)
Cromag.UTC(year, month, day, hour, minute, second)
Cromag.UTC(year, month, day, hour, minute, second, millisecond)
year - Number
representing the year
month - Number
representing the month, 0
for January
through 11
for December
day - Number
representing the day of the month 1-31
hour - Number
representing the hour of the day 0-23
minute - Number
representing the minute of the hour 0-59
second - Number
representing the second of the minute 0-59
millisecond - Number
representing the millisecond 0-999
Returns a new instance of Cromag
set to 00:00:00
local time of the current day.
Cromag.today()
Returns a new instance of Cromag
set to 00:00:00
local time of the next day.
Cromag.tomorrow()
Returns a new instance of Cromag
set to 00:00:00
local time of the previous day.
Cromag.yesterday()
Returns boolean
as to whether the date passed is valid.
Cromag.validateDay(day, year, month)
day - Number
representing the day of the month, 1-31
year - Number
representing the year
month - Number
representing the month, 0-11
Returns boolean
as to whether the year passed is valid
Cromag.validateYear(year)
year - Number
representing the year
Returns boolean
as to whether the month passed is valid
Cromag.validateMonth(month)
month - Number
representing the month, 1-31
Returns boolean
as to whether the hour passed is valid
Cromag.validateHour(hour)
hour - Number
representing the hour, 0-23
Returns boolean
as to whether the minute passed is valid
Cromag.validateMinute(minute)
minute - Number
representing the minute, 0-59
Returns boolean
as to whether the second passed is valid
Cromag.validateSecond(second)
second - Number
representing the second, 0-59
Returns boolean
as to whether the millisecond passed is valid
Cromag.validateMillisecond(millisecond)
millisecond - Number
representing the millisecond, 0-999
Returns -1
if date1
is less than date2
, 0
if they are the same, or 1
if date1
is more recent than date2
.
Cromag.compare(date1, date2)
date1 - Cromag
first date/time to compare
date2 - Cromag
second date/time to compare
Returns boolean
as to whether date1
is equal to date2
.
Cromag.equals(date1, date2)
date1 - Cromag
first date/time to compare
date2 - Cromag
second date/time to compare
Returns the Number
representing the day passed in, 0-7
Cromag.getDayNumberFromName(name)
name - String
day as 2 characters, 3 characters, or full day, su/sun/sunday
Returns the Number
representing the month passed in, 0-11
Cromag.getMonthNumberFromName(name)
name - String
day as 3 characters or full month, jan/january
Returns boolean
as to whether the year passed is a leap year
Cromag.isLeapYear(year)
year - Number
year to check
Returns the Number
of days in the month passed, 1-31
Cromag.getDaysInMonth(monthNumber)
monthNumber - Number
of the month to check, 0-11
Adds and subtracts (in case of negative values) time
d.add(offsets)
offsets - Object
containing a mix of milliseconds
, seconds
, minutes
, hours
, days
, weeks
, months
, and years
Adds and subtracts the Number
of days
d.addDays(days)
days - Number
of days
Adds and subtracts the Number
of hours
d.addHours(hours)
hours - Number
of hours
Adds and subtracts the Number
of milliseconds
d.addMilliseconds(milliseconds)
milliseconds - Number
of milliseconds
Adds and subtracts the Number
of minutes
d.addMinutes(minutes)
minutes - Number
of minutes
Adds and subtracts the Number
of months
d.addMonths(months)
months - Number
of months
Adds and subtracts the Number
of seconds
d.addMSeconds(seconds)
seconds - Number
of seconds
Adds and subtracts the Number
of years
d.addYears(years)
years - Number
of years
Returns boolean
as to whether the date is between date1
and date2
d.between(date1, date2)
date1 - Cromag
first date/time to compare
date2 - Cromag
seconds date/time to compare
Sets the time to 00:00:00
in the current locale
d.clearTime()
Returns a Cromag
object set to the same date/time
d.clone()
Returns -1
if date
is less than date/time, 0
if they are the same, or 1
if date
is more recent
d.compare(date)
date - Cromag
date to compare to
Returns boolean
as to whether the date
passed is equal to the date/time
d.equals(date)
date - Cromag
date to compare to
Returns the Number
day of the month, 1-31
d.getDate()
Returns the Number
day of the week, 0-6
d.getDay()
Returns the Number
of days between the date
passed and this instance
d.getDaysBetween(date)
date - Cromag
date to compare to
Returns the Number
full year, 4 digits
d.getFullYear()
Returns the Number
of the hour, 0-23
d.getHours()
Returns the Number
of hours between the date
passed and this instance
d.getHoursBetween(date)
date - Cromag
date to compare to
Returns the Number
of the milliseconds, 0-999
d.getMilliseconds()
Returns the Number
of the minutes, 0-59
d.getMinutes()
Returns the Number
of minutes between the date
passed and this instance
d.getMinutesBetween(date)
date - Cromag
date to compare to
Returns the Number
of the month, 0-11
d.getMonth()
Returns the String
representation of the abbreviated version of the month, Jan-Dec
d.getMonthAbbr()
Returns the String
representation of the month, January-December
d.getMonthName()
Returns the Number
of the year, 1-366
d.getOrdinalNumber()
Returns the Number
of the second, 0-59
d.getSeconds()
Returns the Number
of seconds between the date
passed and this instance
d.getSecondsBetween(date)
date - Cromag
date to compare to
Returns the Number
value of the milliseconds since the epoch
, similar to valueOf()
d.getTime()
Returns the Number
of minutes of the time-zone offset for the current locale
d.getTimezoneOffset()
Returns the Number
day of the month, universal time
d.getUTCDate()
Returns the Number
day of the week, universal time
d.getUTCDay()
Returns the Number
full year, universal time
d.getUTCFullYear()
Returns the Number
of the hour, universal time
d.getUTCHours()
Returns the Number
of the milliseconds, universal time
d.getUTCMilliseconds()
Returns the Number
of the minutes, universal time
d.getUTCMinutes()
Returns the Number
of the month, universal time
d.getUTCMonth()
Returns a String
representation of the UTC Offset
d.getUTCOffset()
Returns the Number
of the second, universal time
d.getUTCSeconds()
Returns the boolean
value of whether the date/time is after date
d.isAfter(date)
date - Cromag
representing a date/time
Returns the boolean
value of whether the date/time is before date
d.isBefore(date)
date - Cromag
representing a date/time
Sets the day of the month, 1-31
d.setDate(day)
day - Number
representing the day of the month, 1-31
Sets the year
d.setFullYear(year)
year - Number
representing the year
Sets the hour of the day, 0-23
d.setHours(hour)
hour - Number
representing the hour of the day, 0-23
Sets the number of milliseconds
d.setMilliseconds(milliseconds)
milliseconds - Number
representing the number of milliseconds, 0-999
Sets the minutes of the hour, 0-59
d.setMinutes(minute)
minute - Number
representing the minute of the hour, 0-59
Sets the month of the year, 0-11
d.setMonth(month)
month - Number
representing the month of the year, 0-11
Sets the seconds of the hour, 0-59
d.setSeconds(seconds)
seconds - Number
representing the seconds of the hour, 0-59
Sets the date and time to the number of milliseconds since the epoch
d.setTime(time)
time - Number
representing the number of seconds since the epoch
Sets the date/time to the current value
d.setTimeToNow()
Sets the day of the month, 1-31
, universal time
d.setUTCDate(day)
day - Number
representing the day of the month, 1-31
Sets the year, universal time
d.setUTCFullYear(year)
year - Number
representing the year
Sets the hour of the day, 0-23
, universal time
d.setUTCHours(hour)
hour - Number
representing the hour of the day, 0-23
Sets the number of milliseconds, universal time
d.setUTCMilliseconds(milliseconds)
milliseconds - Number
representing the number of milliseconds, 0-999
Sets the minutes of the hour, 0-59
, universal time
d.setUTCMinutes(minute)
minute - Number
representing the minute of the hour, 0-59
Sets the month of the year, 0-11
, universal time
d.setUTCMonth(month)
month - Number
representing the month of the year, 0-11
Sets the seconds of the hour, 0-59
, universal time
d.setUTCSeconds(seconds)
seconds - Number
representing the seconds of the hour, 0-59
Returns a String
representation of this in an Apache CLF format
d.toCLFString()
Returns the date
portion of the date/time as a String
d.toDateString()
Returns a String
representation of this in a YYYY-MM-DD HH24:MI:SS
format
d.toDBString()
Returns a String
representation of this formatted with the format passed
d.toFormat(format)
format - String
representing the format, including MM
, DD
, YYYY
, YY
, MI
, SS
, HH
, HH24
Returns the date/time in ISO 8601 Extended Format as a String
d.toISOString()
Returns the JSON
string representation of the date/time as a String
d.toJSON()
Returns the String
representation of the date
in the current locale
d.toLocaleDateString()
Returns the String
representation of the date
and time
in the current locale
d.toLocaleString()
Returns the String
representation of the time
in the current locale
d.toLocaleTimeString()
Returns the String
representation of the date
and time
in the current locale
d.toString()
Returns the String
representation of the time
in the current locale
d.toTimeString()
Returns the String
representation of the date
and time
in universal time
d.toUTCString()
Returns the Number
of milliseconds since the epoch
d.valueOf()
Returns a String
representation of year
, month
, and day
with value
as the separator
d.toYMD(value)
value - String
representing a separator
FAQs
Date and Time Without the Monkeys
We found that cromag demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.