Menampilkan semua direktif pemformatan tanggal dan waktu yang didukung beserta contoh dan catatan penggunaannya.
Semua direktif sepenuhnya kompatibel dengan standar C (versi 1989).
|
Directive |
Description |
Example |
Notes |
|
%a |
Abbreviated weekday name. |
|
Hanya locale en-US yang saat ini didukung. |
|
%A |
Full weekday name. |
|
Hanya locale en-US yang saat ini didukung. |
|
%w |
Weekday as a decimal number, where 0 is Sunday and 6 is Saturday. |
|
Tidak ada. |
|
%d |
Day of the month as a zero-padded decimal number. |
|
Saat melakukan parsing, angka nol di awal tidak diperlukan untuk direktif |
|
%b |
Abbreviated month name for the locale. |
|
Hanya locale en-US yang saat ini didukung. |
|
%B |
Full month name for the locale. |
|
Saat melakukan parsing, angka nol di awal tidak diperlukan untuk direktif |
|
%m |
Month as a zero-padded decimal number. |
|
Saat melakukan parsing, angka nol di awal tidak diperlukan untuk direktif |
|
%y |
Year without century as a zero-padded decimal number. |
|
Saat melakukan parsing, angka nol di awal tidak diperlukan untuk direktif |
|
%Y |
Year with century as a decimal number. |
|
Saat melakukan parsing tahun, rentang nilai yang valid adalah [1, 9999]. Jika tahun kurang dari 1000, nilai tersebut harus diisi dengan nol hingga empat digit. Sebagai contoh, 0180 merepresentasikan tahun 180 M. |
|
%H |
Hour (24-hour clock) as a zero-padded decimal number. |
|
Saat melakukan parsing, angka nol di awal tidak diperlukan untuk direktif |
|
%I |
Hour (12-hour clock) as a zero-padded decimal number. |
|
Saat melakukan parsing, angka nol di awal tidak diperlukan untuk |
|
%p |
The locale's equivalent of AM or PM. |
|
|
|
%M |
Minute as a zero-padded decimal number. |
|
Saat melakukan parsing, angka nol di awal tidak diperlukan untuk direktif |
|
%S |
Second as a zero-padded decimal number. |
|
|
|
%f |
Microsecond as a zero-padded decimal number. |
|
Saat melakukan parsing mikrodetik, direktif |
|
%z |
UTC offset in the ±HHMM[SS[.ffffff]] format. Returns an empty string for a naive datetime object. |
|
Untuk objek datetime naive, |
|
%Z |
Time zone name. Returns an empty string if the object is naive. |
|
Tidak ada. |
|
%j |
Day of the year as a zero-padded decimal number. |
|
Saat melakukan parsing, angka nol di awal tidak diperlukan untuk direktif |
|
%U |
Week number of the year, with Sunday as the first day of the week. Days before the first Sunday of the year are in week 0. |
|
|
|
%W |
Week number of the year, with Monday as the first day of the week. Days before the first Monday of the year are in week 0. |
|
|
|
%c |
The locale's appropriate date and time representation. |
|
Hanya locale en-US yang saat ini didukung. |
|
%x |
The locale's appropriate date representation. |
|
Hanya locale en-US yang saat ini didukung. |
|
%X |
The locale's appropriate time representation. |
|
Hanya locale en-US yang saat ini didukung. |
|
%% |
A literal |
|
Tidak ada. |
Direktif non-standar C89 berikut juga didukung:
|
Directive |
Description |
Example |
Notes |
|
%G |
ISO 8601 week-based year. This is the year that contains the ISO week (%V). |
|
Saat melakukan parsing, |
|
%u |
ISO 8601 weekday as a decimal number, where 1 is Monday. |
|
Tidak ada. |
|
%V |
ISO 8601 week number of the year (Monday as the first day of the week). |
|
|