Formats
inspired by momentjs
Type |
Token |
Output |
Year |
[ jYYYY, jy ] |
1350 1351 ... 1399 1400 |
|
jYY |
50 51 ... 99 00 |
Month |
[ jMMMM, jMMM ] |
فروردین اردیبهشت ... بهمن اسفند |
|
jMM |
01 02 ... 11 12 |
|
jMO |
اولین دومین ... یازدهمین دوازدهمین |
|
jMo |
اول دوم ... یازدهم دوازدهم |
|
jM |
1 2 ... 11 12 |
Day of Month |
jDD |
01 02 ... 30 31 |
|
jDO |
اولین دومین ... سیامین سی و یکمین |
|
jDo |
اول دوم ... سیام سی و یکم |
|
jD |
1 2 ... 30 31 |
Day of Week |
[ jdddd, jddd ] |
شنبه یکشنبه ... پنج شنبه جمعه |
|
jdd |
ش ی ... پ ج |
|
jdO |
اولین دومین ... ششمین هفتمین |
|
jdo |
اول دوم ... ششم هفتم |
|
jde |
1 2 ... 6 7 |
|
jd |
0 1 ... 5 6 |
Day of Year |
jDDDD |
001 002 ... 364 365 |
|
jDDDO |
اولین دومین ... سیصدوشصتوچهارمین سیصدوشصتوپنجمین |
|
jDDDo |
اول دوم ... سیصدوشصتوچهار سیصدوشصتوپنجم |
|
jDDD |
1 2 ... 364 365 |
Quarter |
jQO |
اولین دومین سومین چهارمین |
|
jQo |
اول دوم سوم چهارم |
|
jQ |
1 2 3 4 |
Week |
[ jWW, jww ] |
01 02 ... 52 53 |
|
[ jWO, jwO ] |
اولین دومین ... پنجاه و دومین پنجاه و سومین |
|
[ jWo, jwo ] |
اول دوم ... پنجاه و دوم پنجاه و سوم |
|
[ jW, jw ] |
1 2 ... 52 53 |
Hour |
HH |
00 01 ... 22 23 |
|
H |
0 1 ... 22 23 |
|
hh |
01 02 ... 11 12 |
|
h |
1 2 ... 11 12 |
|
kk |
01 02 ... 23 24 |
|
k |
1 2 ... 23 24 |
Minute |
mm |
00 01 ... 58 59 |
|
m |
0 1 ... 58 59 |
Second |
ss |
00 01 ... 58 59 |
|
s |
0 1 ... 58 59 |
Millisecond |
CCCC |
000 001 ... 998 999 |
|
[ CCC, c ] |
0 1 ... 998 999 |
Timestamp |
t |
1609446600000 |
AM/PM |
jA |
قبلازظهر بعدازظهر |
|
jaa |
ق.ظ ب.ظ |
|
ja |
ق ظ ب ظ |
Generally, the difference between Gregorian formats and Persian formats is in the 'J' letter
Type |
Token |
Output |
Year |
[ YYYY, y ] |
1970 1971 ... 2029 2030 |
|
YY |
70 71 ... 29 30 |
Month |
MMMM |
January February ... November December |
|
MMM |
Jan Feb ... Nov Dec |
|
MM |
01 02 ... 11 12 |
|
[ MO, Mo ] |
1st 2nd ... 11th 12th |
|
M |
1 2 ... 11 12 |
Day of Month |
DD |
01 02 ... 30 31 |
|
[ DO, Do ] |
1st 2nd ... 30th 31st |
|
D |
1 2 ... 30 31 |
Day of Week |
dddd |
Sunday Monday ... Friday Saturday |
Day of Week |
ddd |
Sun Mon ... Fri Sat |
|
dd |
Su Mo ... Fr Sa |
|
[ dO, do ] |
1st 2nd ... 6th 7th |
|
de |
1 2 ... 6 7 |
|
d |
0 1 ... 5 6 |
Day of Year |
DDDD |
001 002 ... 364 365 |
|
[ DDDO, DDDo ] |
1st 2nd ... 364th 365th |
|
DDD |
1 2 ... 364 365 |
Quarter |
[ QO, Qo ] |
1st 2nd 3rd 4th |
|
Q |
1 2 3 4 |
Week |
[ WW, ww ] |
01 02 ... 52 53 |
|
[ WO, wO, Wo, wo ] |
1st 2nd ... 52nd 53rd |
|
[ W, w ] |
1 2 ... 52 53 |
Hour |
HH |
00 01 ... 22 23 |
|
H |
0 1 ... 22 23 |
|
hh |
01 02 ... 11 12 |
|
h |
1 2 ... 11 12 |
|
kk |
01 02 ... 23 24 |
|
k |
1 2 ... 23 24 |
Minute |
mm |
00 01 ... 58 59 |
|
m |
0 1 ... 58 59 |
Second |
ss |
00 01 ... 58 59 |
|
s |
0 1 ... 58 59 |
Millisecond |
CCCC |
000 001 ... 998 999 |
|
[ CCC, c ] |
0 1 ... 998 999 |
Timestamp |
t |
1609446600000 |
AM/PM |
A |
AM PM |
|
aa |
A.M. P.M. |
|
a |
am pm |
Aliases 1.0.0+
Alias |
Format in Jalali calendar |
Format in Gregorian calendar |
Output |
datetime |
jYYYY/jMM/jDD HH:mm |
YYYY-MM-DD HH:mm |
1400/01/01 13:07 | 2021-01-01 13:07 |
date |
jYYYY/jMM/jDD |
YYYY-MM-DD |
1400/01/01 | 2021-01-01 |
time |
HH:mm |
HH:mm |
13:07 |
let p = new PersianDate('1400/1/1 13:7','jalali');
p.calendar('j').toString('datetime'); // 1400/01/01 13:07
p.calendar('g').toString('datetime'); // 2021-03-21 13:07