1lastconnection = datetime.strptime("21/12/2008", "%d/%m/%Y").strftime('%Y-%m-%d')
1 var dateString1 = DateTime.Now.ToString("yyyyMMdd");
2 var dateString2 = DateTime.Now.ToString("yyyy-MM-dd");
3
4 Console.WriteLine("yyyyMMdd " + dateString1);
5 Console.WriteLine("yyyy-MM-dd "+ dateString2);
6
1import re
2def change_date_format(dt):
3 return re.sub(r'(\d{4})-(\d{1,2})-(\d{1,2})', '\\3-\\2-\\1', dt)
4dt1 = "2026-01-02"
5print("Original date in YYY-MM-DD Format: ",dt1)
6print("New date in DD-MM-YYYY Format: ",change_date_format(dt1))
7
8
1from datetime import datetime
2now = datetime.today().isoformat()
3print(now) # '2018-12-05T11:15:55.126382'
4