Skip to content
moxon home

Time Information

The /time endpoint allows you to retrieve time information based on various parameters. You can get the current time or a random time between a specified range, in different formats and time zones.

gethttps://api.moxon.dev/v4/time
Try itget/v4/time

Parameters

  • type"live" | "random" | "countdown"optional

    live (default) for current time, random for a random time, countdown for time until a target

  • startstringoptional

    Start date for random range (format: YYYY-MM-DD)

  • endstringoptional

    End date for random range (format: YYYY-MM-DD)

  • targetstringoptional

    Target date for countdown mode (format: YYYY-MM-DD or ISO 8601)

  • formatstringoptional

    Response format (see options below)

    • iso
    • utc
    • timestamp
    • locale
    • date
    • time
    • year
    • month
    • day
    • hour
    • minute
    • second
    • ms
    • dayOfWeek
    • dayOfYear
    • weekNumber
    • timezone
  • timezonestringoptional

    Time zone to use (see options below)

    • UTC
    • Europe/Paris
    • America/New_York
    • Asia/Tokyo
    • Australia/Sydney

Format Options

FormatDescription
isoISO 8601 format (default)
utcUTC format
timestampUnix timestamp
localeLocal format
dateDate in MM/DD/YYYY format
timeTime in HH:MM:SS format
yearYear only
monthMonth only
dayDay only
hourHour only
minuteMinutes only
secondSeconds only
msMilliseconds only
dayOfWeekDay of the week (0-6)
dayOfYearDay of the year (1-365/366)
weekNumberWeek number
timezoneTime zone name

Timezone Options

TimezoneDescription
UTCCoordinated Universal Time (default)
Europe/ParisParis time zone
America/New_YorkNew York time zone
Asia/TokyoTokyo time zone
Australia/SydneySydney time zone

Response Fields

  • isostring

    Date in ISO 8601 format

  • utcstring

    Date in UTC string format

  • timestampnumber

    Unix timestamp

  • localestring

    Localized date and time string

  • datestring

    Date in MM/DD/YYYY format

  • timestring

    Time in HH:MM:SS format

  • yearnumber

    Year

  • monthnumber

    Month (1-12)

  • daynumber

    Day of the month

  • hournumber

    Hour (0-23)

  • minutenumber

    Minutes

  • secondnumber

    Seconds

  • msnumber

    Milliseconds

  • dayOfWeeknumber

    Day of the week (0-6)

  • dayOfYearnumber

    Day of the year (1-365/366)

  • weekNumbernumber

    Week number of the year

  • timezonestring

    Time zone name

  • timezoneOffsetnumber

    UTC offset of the time zone

Code Examples

Error Handling

If parameters are invalid, the API will return an error:

  • 400Please provide a valid type (?type={type})The type parameter is invalid
  • 400Please provide a valid start date (?start={YYYY-MM-DD})The start parameter is invalid
  • 400Please provide a valid end date (?end={YYYY-MM-DD})The end parameter is invalid
  • 400Please provide a valid target date (?target=...)The target parameter is invalid
  • 400Please provide a valid format (?format={format})The format parameter is invalid
  • 400Please provide a valid timezone (?timezone={timezone})The timezone parameter is invalid