From: "Lawrence Velázquez" <larryv@macports.org>
To: TJ Luoma <luomat@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: best way to convert UTC to local time?
Date: Tue, 11 Jun 2013 22:01:23 -0400 [thread overview]
Message-ID: <F56DE513-0594-49CE-BC40-A4BDCFB26962@macports.org> (raw)
In-Reply-To: <83808ECC-34C4-42F6-B47B-70F26A6C03BD@gmail.com>
On Jun 11, 2013, at 5:51 PM, TJ Luoma <luomat@gmail.com> wrote:
> This works, but three separate `strftime` calls seems inefficient. I mean, it's not like it takes a long time to run or anything, I'm just wondering if there's a "better" way.
Well, if you're willing to use an external command, you could go with date(1):
for F in "$@"; do
[[ -f "$F" && -r "$F"]] || continue
DATE_ADDED_UTC=$(mdls -raw -name kMDItemDateAdded "$F")
[[ "$DATE_ADDED_UTC" != "(null)" ]] || continue
DATE_ADDED_LOCAL=$(date -jf '%F %T %z' "$DATE_ADDED_UTC" '+%F')
echo "The file $F was added on $DATE_ADDED_LOCAL"
done
vq
next prev parent reply other threads:[~2013-06-12 2:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-11 21:51 TJ Luoma
2013-06-12 2:01 ` Lawrence Velázquez [this message]
2013-06-12 4:42 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=F56DE513-0594-49CE-BC40-A4BDCFB26962@macports.org \
--to=larryv@macports.org \
--cc=luomat@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).