Formatting Dates
>>> from datetime import datetime
>>> datetime.today().strftime('%Y-%m-%d')
'2021-01-26'
Formatting Dates
>>> from datetime import datetime
>>> datetime.today().strftime('%Y-%m-%d')
'2021-01-26'
date format example
Pattern Result
---------------- -------
DateFormat.yMd() -> 7/10/1996
DateFormat('yMd') -> 7/10/1996
DateFormat.yMMMMd('en_US') -> July 10, 1996
DateFormat.jm() -> 5:08 PM
DateFormat.yMd().add_jm() -> 7/10/1996 5:08 PM
DateFormat.Hm() -> 17:08 // force 24 hour time
format date
const formatDate = date => {
return (
date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
);
};
console.log(formatDate(new Date()));
get date in format
// GET THE CURRENT TIME............
const date = new Date();
var year = date.getUTCFullYear();
var month = (date.getUTCMonth()).toString.length == 2 ? date.getUTCMonth(): '0'+ date.getUTCMonth() ;
var day = (date.getUTCDay()).toString.length == 2 ? date.getUTCDay(): '0'+ date.getUTCDay() ;
var hours = date.getUTCHours();
var minutes = date.getUTCMinutes();
exDate = 'beckup_'+ year + '-' + month + '-' + day + '-' + hours + '-' + minutes ;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us