Skip to content
项目

关于

:trollface: Year as a Service, est. 2015

开发工具

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

YaaS

Year as a Service. Providing you with extremely accurate year as an API service, since 2015.

Examples

Note that these examples may not take into account good security practices, for example escaping output to prevent XSS vulnerabilities.

PHP

<?php
$year = file_get_contents('https://raw.github.com/asgrim/year/master/en/currentYear');

echo $year; // 2025

Ruby

require 'net/http'
year = Net::HTTP.get_response(URI.parse("https://raw.github.com/asgrim/year/master/en/currentYear")).body
p year # 2025

Python

import urllib2
year = urllib2.urlopen('https://raw.github.com/asgrim/year/master/en/currentYear').read(1000).strip()
print year; # 2025

JavaScript

// Fetch
fetch('https://raw.githubusercontent.com/asgrim/year/master/en/currentYear')
    .then(resp => resp.json())
    .then(year => console.log(year)) // 2025

// XMLHttpRequest
let xhr = new XMLHttpRequest()
xhr.open('GET', 'https://raw.githubusercontent.com/asgrim/year/master/en/currentYear', true);
xhr.onload = () => {
    if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
        console.log(xhr.responseText)
    }
};
xhr.send(); // 2020

Bash

#!/bin/bash
## Fetch
page="$(curl -s https://raw.githubusercontent.com/asgrim/year/master/en/currentYear)"
echo "$page" # 2025

BC Break

In the future, we may have to break BC by removing the root "currentYear". You should use "en/currentYear" instead.

Internationalisation (i18n)

YaaS also supports the following calendars:

Hebrew (he):

Chinese (zh-cn):

FAQs

Should I use this in my real application?

  • No.

r u troleing me?

  • Yes.

探索相关项目

加载中…