Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
export default async function(req: Request): Promise<Response> {
interface DateTimeFormatsOutput {
iso: string;
unix: number;
}
function getSpecificDateTime(): Date {
return new Date();
}
function generateDateTimeFormatsOutput(): DateTimeFormatsOutput {
const specificDateTime = getSpecificDateTime();
return {
iso: specificDateTime.toISOString(),
unix: Math.floor(specificDateTime.getTime() / 1000),
};
}
const result: DateTimeFormatsOutput = generateDateTimeFormatsOutput();
return Response.json(result);
}
tudorizer-datetime.web.val.run
December 29, 2023