import Foundation
// Use Date() to get the current date and time
let now = Date()
print(now)
// That is UTC. How to get time zone +02:00 ?
// Get the number of seconds since the Unix epoch
print(now.timeIntervalSince1970)
// Days of epoch
let days = now.timeIntervalSince1970 / (3600*24)
print("Days since 1970 \(days)")
print("Whole days \(Int(days))")
let dayFract = days - Double(Int(days))
let hours = 24.0*dayFract
print("plus hours \(Int(hours))")
let hourFract = hours - Double(Int(hours))
let minutes = 60*hourFract
print("plus minutes \(Int(minutes))")
let minuteFract = minutes - Double(Int(minutes))
let seconds = 60*minuteFract
print("+seconds \(seconds)")
print("""
Note, Julian Date Numbers can be calculated
with day offset from Posix dates
""")
// Maybe shorter code is possible using module function.
// Posix functions got from
// https://[Log in to view URL]
To embed this project on your website, copy the following code and paste it into your website's HTML: