Blog

Find out about the latest from Cloudmersive.

API Spotlight: Date & Time APIs
4/20/2023 - Brian O'Neill


For a network of cloud-hosted applications to operate effectively in conjunction with one another, it’s essential that they share a singular, standardized date and time retrieval service. Without syncing a date and time retrieval services across our systems, our time-sensitive automated services can quickly run off the rails, our new schedule inputs (i.e., online bookings and meetings) can be stored incorrectly, and our ability to account for perpetually moving targets on the calendar – like public holidays, for example – can fall by the wayside.

Cloudmersive Date & Time APIs make it easy to integrate high quality, reliable date & time management services and sync them across all your applications. Below, we’ll take a closer look at three of our Date & Time API iterations and get a better understanding of how they can impact your business.

Get Current Date and Time

Implementing our Current Date & Time API gives all your applications access to a centrally available clock – synchronized with atomic clocks – ensuring the utmost accuracy and consistency in Date & Time retrieval. Executing a Get request returns the current date and time for your region (expressed in TimeSpan format), and it also returns Greenwich Mean Time (GMT) for a central reference value.

Get Public Holidays in the Specified Country and Year

Each country has its own evolving list of national public holidays. No matter where your business is located, it’s helpful to enumerate this list at the beginning of each year, and it’s essential to reference schedules against this data when planning important meetings or events over the course of the year.

Structuring your request with country and current-year inputs will return a full list of your country’s public holidays. This includes the following array of information (for each):

  • EnglishName: the name of the holiday in English
  • LocalName: the local name of the holiday in English
  • OccurenceData: the exact date (in TimeSpan format) of the holiday for the specified year
  • HolidayType: the type of holiday in question
  • Nationwide: a string describing whether the holiday is observed across the entire nation

Parse a Free-Form Natural Language Date and Time String into a Date and Time

Generally speaking, the way people like to communicate date and time information is quite different from the way computer applications do. While computers benefit from communicating with standard, structured time values in TimeSpan format, people instead like to make lightweight, unstructured date and time references with context rooted in the present moment. For example, if todays' date is 4/18/2023, instead of asking if their peer is available to meet at 2023-04-19T13:00:00, a colleague would likely ask if they’re available to meet “tomorrow at 1 pm.”

This service parses natural language inputs – such as in the example above – into timespan format, and it additionally returns integers describing the year, month, day, hour, minute, second, and day of the week values from in the original statement (as much information as is made available). To do so, it references the local date and time where the information is originally parsed and processed. The above example would return the following information:

  • ParsedDateResult: 2023-04-19T13:00:00
  • Year: 2023
  • Month: 4
  • Day: 21
  • Hour: 13
  • Minute: 0
  • Second: 0
  • DayOfWeek: Wednesday

For more information on Cloudmersive Date & Time APIs, please do not hesitate to reach out to a member of our sales team.

800 free API calls/month, with no expiration

Get started now! or Sign in with Google

Questions? We'll be your guide.

Contact Sales