Date
From ICO wiki
Teema on valmimisel
Sissejuhatus
Date - käsuga saab masinalt küsida kellaaega ja kuupäeva. Administraator saab date käsu abil ka kuupäeva ja kellaaega muuta.
Date käsu kasutamine
Lihtsalt date käsk väljastab standard kujul aja: Päev Kuu Kuupäev kellaeg ajatsoon aasta
$date Tulemus: Sat Mar 19 15:22:48 EET 2011
Date käsu küsimine kindlate parameetritega
Date käsuga saab küsida masinalt soovitavat aega sobival kujul. $date käsule tuleb lisada string mis jääb " " vahele ja algab + märgiga. Parameetreid küsitakse kujul %esimene parameeter %teine parameeter. Parameetrite vahele saab valida eraldajaid.
Parameetritega käsu näide: küsitakse %päeva %kuud %aastat ja eraldajateks on . märgid $date "+%d.%m.%y" Tulemus: 19.03.11
Parameetrid
Specifier | Description | Values/Example |
---|---|---|
Day | ||
%a | Nädalapäev lühidalt | {{#time: D}} |
%A | weekday, full | Sunday |
%d | day of the month (dd), zero padded | 24 |
%e | day of the month (dd) | 24 |
%j | day of year, zero padded | 001-366 |
%u | day of week starting with Monday (1), i.e. mtwtfss | {{#time: N}} |
%w | day of week starting with Sunday (0), i.e. smtwtfs | {{#time: w}} |
Week | ||
%U | week number Sunday as first day of week | 01–53 |
%W | week number Monday as first day of week | 01–53 |
%V | week of the year | 01–53 |
Month | ||
%m | mm month | 11 |
%h | Mon | Nov |
%b | Mon, locale's abbreviated | Nov |
%B | locale's full month, variable length | November |
Year | ||
%y | yy two digit year | 00–99 |
%Y | ccyy year | {{#time: Y}} |
%g | 2-digit year corresponding to the %V week number | |
%G | 4-digit year corresponding to the %V week number | |
Century | ||
%C | cc century | 00–99 |
Date | ||
%D | mm/dd/yy | 11/24/{{#time: y}} |
%x | locale's date representation (mm/dd/yy) | 11/24/2024 |
%F | %Y-%m-%d | 2024-11-24 |
Hours | ||
%l (Lowercase L) | hour (12 hour clock) | {{#time: g}} |
%I (Uppercase I) | hour (12 hour clock) zero padded | {{#time: h}} |
%k | hour (24 hour clock) | {{#time: G}} |
%H | hour (24 hour clock) zero padded | {{#time: H}} |
%p | locale's upper case AM or PM (blank in many locales) | {{#time: A}} |
%P | locale's lower case am or pm | {{#time: a}} |
Minutes | ||
%M | MM minutes | {{#time: i}} |
Seconds | ||
%s | seconds since 00:00:00 1970-01-01 UTC (Unix epoch) | {{#time: U}} |
%S | SS second | 00–60 (The 60 is necessary to accommodate a leap second) |
%N | nanoseconds | 000000000–999999999 |
Time | ||
%r | hours, minutes, seconds (12-hour clock) | {{#time: h:i:s A}} |
%R | hours, minutes (24 hour clock) | hh:mm e.g. 04:59 |
%T | hours, minutes, seconds (24-hour clock) | {{#time: H:i:s}} |
%X | locale's time representation (%H:%M:%S) | |
Date and Time | ||
%c | locale's date and time | Sat Nov 04 12:02:33 EST 1989 |
Time zone | ||
%z | -zzzz RFC-822 style numeric timezone | -0500 |
%Z | time zone (e.g., EDT) nothing if no time zone is determinable | EST |