Get the current date and time in deno using the datetime module
1
// import * as wmill from "https://deno.land/x/windmill@v1.61.1/mod.ts"
2
3
import { format } from "https://deno.land/std@0.91.0/datetime/mod.ts";
4
5
export async function main() {
6
// current date in YYYY-MM-DD format
7
console.log(format(new Date(), "yyyy-MM-dd"));
8
9
// current date & time in YYYY-MM-DD hh:mm:ss format
10
console.log(format(new Date(), "yyyy-MM-dd HH:mm:ss"));
11
12
// current time in hh:mm format
13
console.log(format(new Date(), "HH:mm"));
14
}
15