datetime.now() timezone code example
Example 1: datetime python timezone
import datetime
import pytz
my_date = datetime.datetime.now(pytz.timezone('US/Pacific'))
Example 2: datetime today
from datetime import datetime
now = datetime.now()
print("now =", now)
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
print("date and time =", dt_string)
Example 3: javascript date timezone
const start = Date.now();
console.log('starting timer...');
setTimeout(() => {
const millis = Date.now() - start;
console.log(`seconds elapsed = ${Math.floor(millis/1000)}`);
}, 2000);