pip install moment python import moment python import moment current_date = moment.now() formatted_date = current_date.format('YYYY-MM-DD') print(formatted_date) python import moment date_str = '2021-01-01' parsed_date = moment.date(date_str) print(parsed_date) python import moment current_date = moment.now().timezone('Asia/Shanghai') formatted_date = current_date.format('YYYY-MM-DD HH:mm:ss') print(formatted_date) python import moment current_date = moment.now() formatted_date = current_date.format('YYYY-MM-DD') print(formatted_date) date_str = '2021-01-01' parsed_date = moment.date(date_str) print(parsed_date) current_date = moment.now().timezone('Asia/Shanghai') formatted_date = current_date.format('YYYY-MM-DD HH:mm:ss') print(formatted_date)


上一篇:
下一篇:
切换中文