Skip to content

TheUnknownOnes/api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

api-Project

Services

ConvertDateTime

Endpoint: (https://api.theunknownones.net/convertdatetime.php)

Methods: GET,POST

Purpose: Convert a given datetime within a given timzone to a datetime in other timzone.

Gimmicks: You can choose the format of the output and add an modifier (for example "+1 hour")

Required parameters:

Optional parameters:

  • from_format
  • to_format
  • modify
    • Type: string
    • Content: if this param is supplied, the modifier will be applied to from_datetime and to_datetime and the resulting values will be returned additionally (read this for possible values)
    • Default: (empty)

Returns:

  • Content-Type: application/json
    • at least the field result with the two possible values ok or error will be part aof the result
  • HTTP-Codes:
    • 200 if everything is ok
    • 400 if there is a problem with your input
      • a field message will be part of the result, which shows the cause of the error

Examples:

convertdatetime.php?from_datetime=27.7.2020 15:35&from_timezone=Europe/Berlin&to_timezone=UTC

{
  "result": "ok",
  "from": {
    "datetime": "2020.07.27 15:35:00 (CEST)"
  },
  "to": {
    "datetime": "2020.07.27 13:35:00 (UTC)"
  }
}

convertdatetime.php?from_datetime=27.7.2020 15:35&from_timezone=Europe/Berlin&to_timezone=UTC&from_format=U&to_format=r

{
  "result": "ok",
  "from": {
    "datetime": "1595856900"
  },
  "to": {
    "datetime": "Mon, 27 Jul 2020 13:35:00 +0000"
  }
}

convertdatetime.php?from_datetime=27.7.2020 15:35&from_timezone=Europe/Berlin&to_timezone=UTC&from_format=U&to_format=r&modify=+1 week

{
  "result": "ok",
  "from": {
    "datetime": "1595856900",
    "datetime_modified": "1596461700"
  },
  "to": {
    "datetime": "Mon, 27 Jul 2020 13:35:00 +0000",
    "datetime_modified": "Mon, 03 Aug 2020 13:35:00 +0000"
  }
}

convertdatetime.php?from_datetime=27.7.2020 15:&from_timezone=Europe/Berlin&to_timezone=UTC

{
  "result": "error",
  "message": "Can not parse datetime '27.7.2020 15:'."
}

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages