One-liner to convert and adjust a specified time in FreeBSD
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
It's easy to accept a date in a specified but non-standard format (date -j -f "EXISTING_DATE_FORMAT" "EXISTING_DATE" "OUTPUT_FORMAT"
), and easy to adjust a date with the same command (date -j -v+1y "OUTPUT_FORMAT"
).
I have a date/time in a text string, that I need to convert (so date
can understand it) and then adjust, before echoing it in a given format.
Unfortunately date -j -v+1y -f "EXISTING_DATE_FORMAT" "EXISTING_DATE" "OUTPUT_FORMAT"
doesn't seem to be permitted, or at least isn't working for me. How can I get this effect?
freebsd date
add a comment |Â
up vote
2
down vote
favorite
It's easy to accept a date in a specified but non-standard format (date -j -f "EXISTING_DATE_FORMAT" "EXISTING_DATE" "OUTPUT_FORMAT"
), and easy to adjust a date with the same command (date -j -v+1y "OUTPUT_FORMAT"
).
I have a date/time in a text string, that I need to convert (so date
can understand it) and then adjust, before echoing it in a given format.
Unfortunately date -j -v+1y -f "EXISTING_DATE_FORMAT" "EXISTING_DATE" "OUTPUT_FORMAT"
doesn't seem to be permitted, or at least isn't working for me. How can I get this effect?
freebsd date
Use a seconddate
command inside$(command substitution)
to convert from the existing format
â Philippos
Oct 9 '17 at 12:54
Can you enter this as an answer (hopefully with a simple example to show the exact syntax)? Then I can mark it as correct.
â Stilez
Oct 9 '17 at 13:12
Sorry, I only commented, because I don't have a FreeBSD machine to verify.
â Philippos
Oct 9 '17 at 13:56
Take the last example in the FreeBSD manual page fordate
as a further guide, and you can answer your own question. (-:
â JdeBP
Oct 9 '17 at 14:51
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
It's easy to accept a date in a specified but non-standard format (date -j -f "EXISTING_DATE_FORMAT" "EXISTING_DATE" "OUTPUT_FORMAT"
), and easy to adjust a date with the same command (date -j -v+1y "OUTPUT_FORMAT"
).
I have a date/time in a text string, that I need to convert (so date
can understand it) and then adjust, before echoing it in a given format.
Unfortunately date -j -v+1y -f "EXISTING_DATE_FORMAT" "EXISTING_DATE" "OUTPUT_FORMAT"
doesn't seem to be permitted, or at least isn't working for me. How can I get this effect?
freebsd date
It's easy to accept a date in a specified but non-standard format (date -j -f "EXISTING_DATE_FORMAT" "EXISTING_DATE" "OUTPUT_FORMAT"
), and easy to adjust a date with the same command (date -j -v+1y "OUTPUT_FORMAT"
).
I have a date/time in a text string, that I need to convert (so date
can understand it) and then adjust, before echoing it in a given format.
Unfortunately date -j -v+1y -f "EXISTING_DATE_FORMAT" "EXISTING_DATE" "OUTPUT_FORMAT"
doesn't seem to be permitted, or at least isn't working for me. How can I get this effect?
freebsd date
freebsd date
asked Oct 9 '17 at 12:50
Stilez
441211
441211
Use a seconddate
command inside$(command substitution)
to convert from the existing format
â Philippos
Oct 9 '17 at 12:54
Can you enter this as an answer (hopefully with a simple example to show the exact syntax)? Then I can mark it as correct.
â Stilez
Oct 9 '17 at 13:12
Sorry, I only commented, because I don't have a FreeBSD machine to verify.
â Philippos
Oct 9 '17 at 13:56
Take the last example in the FreeBSD manual page fordate
as a further guide, and you can answer your own question. (-:
â JdeBP
Oct 9 '17 at 14:51
add a comment |Â
Use a seconddate
command inside$(command substitution)
to convert from the existing format
â Philippos
Oct 9 '17 at 12:54
Can you enter this as an answer (hopefully with a simple example to show the exact syntax)? Then I can mark it as correct.
â Stilez
Oct 9 '17 at 13:12
Sorry, I only commented, because I don't have a FreeBSD machine to verify.
â Philippos
Oct 9 '17 at 13:56
Take the last example in the FreeBSD manual page fordate
as a further guide, and you can answer your own question. (-:
â JdeBP
Oct 9 '17 at 14:51
Use a second
date
command inside $(command substitution)
to convert from the existing formatâ Philippos
Oct 9 '17 at 12:54
Use a second
date
command inside $(command substitution)
to convert from the existing formatâ Philippos
Oct 9 '17 at 12:54
Can you enter this as an answer (hopefully with a simple example to show the exact syntax)? Then I can mark it as correct.
â Stilez
Oct 9 '17 at 13:12
Can you enter this as an answer (hopefully with a simple example to show the exact syntax)? Then I can mark it as correct.
â Stilez
Oct 9 '17 at 13:12
Sorry, I only commented, because I don't have a FreeBSD machine to verify.
â Philippos
Oct 9 '17 at 13:56
Sorry, I only commented, because I don't have a FreeBSD machine to verify.
â Philippos
Oct 9 '17 at 13:56
Take the last example in the FreeBSD manual page for
date
as a further guide, and you can answer your own question. (-:â JdeBP
Oct 9 '17 at 14:51
Take the last example in the FreeBSD manual page for
date
as a further guide, and you can answer your own question. (-:â JdeBP
Oct 9 '17 at 14:51
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397015%2fone-liner-to-convert-and-adjust-a-specified-time-in-freebsd%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Use a second
date
command inside$(command substitution)
to convert from the existing formatâ Philippos
Oct 9 '17 at 12:54
Can you enter this as an answer (hopefully with a simple example to show the exact syntax)? Then I can mark it as correct.
â Stilez
Oct 9 '17 at 13:12
Sorry, I only commented, because I don't have a FreeBSD machine to verify.
â Philippos
Oct 9 '17 at 13:56
Take the last example in the FreeBSD manual page for
date
as a further guide, and you can answer your own question. (-:â JdeBP
Oct 9 '17 at 14:51