How to convert svn repository change date to epoch timestamp?
Trond Endrestøl
trond.endrestol at ximalas.info
Sun Nov 3 16:28:43 UTC 2019
On Sun, 3 Nov 2019 13:03+0100, mj-mailinglist at gmx.de wrote:
> I am trying to convert the output of this command
>
> svnlite info --show-item last-changed-date /usr/src/
>
> to an epoch timestamp with base tools.
>
> The output looks like this: 2019-11-03T07:11:09.005639Z
>
> The date man page gives this example for converting dates:
>
> date -j -f "%a %b %d %T %Z %Y" "`date`" "+%s"
> (maybe add the info, that you have to use LC_TIME=C for this example to work)
>
> I came up with this date format string "%Y-%m-%dT%H:%M:%SZ" but this
> lacks the fractions part of the seconds.
>
> Is this possible with the tools in base?
>
> Or maybe i could chop of the second-fractions?
Try this:
date -juf "%FT%TZ" `svnlite info --no-newline --show-item last-changed-date /usr/src | sed 's/\.[0-9]*Z$/Z/'` "+%s"
--
Trond.
More information about the freebsd-questions
mailing list