ocehb: (Default)
[personal profile] ocehb
на входе -- день года, на выходе -- секунд с начала эпохи


function day2date () {
  local a=$(date -d "1 jan" +"%s")
  while [[ $(date -d "1970-01-01 UTC $a seconds" +"%j") -ne $1 ]]; do
    a=$[$a+24*60*60]
  done
  print $a
}

# date -d "1970-01-01 UTC $(day2date 77) seconds" +"%d-%m-%Y"
18-03-2007
#


zsh'изм, но идея понятна.
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

Profile

ocehb: (Default)
ocehb

January 2021

S M T W T F S
     12
345 6789
10111213141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 16th, 2025 04:43 pm
Powered by Dreamwidth Studios