v/examples/fetch.v

13 lines
211 B
V
Raw Normal View History

2020-04-28 13:57:48 +02:00
import time
import net.http
fn main() {
2021-02-23 18:43:44 +01:00
resp := http.get('https://vlang.io/utc_now') or {
println('failed to fetch data from the server')
return
}
2020-04-28 13:57:48 +02:00
2021-02-23 18:43:44 +01:00
t := time.unix(resp.text.int())
println(t.format())
2020-04-28 13:57:48 +02:00
}