One-liner to convert and adjust a specified time in FreeBSD

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash 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?










share|improve this question





















  • 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














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?










share|improve this question





















  • 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












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?










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 9 '17 at 12:50









Stilez

441211




441211











  • 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
















  • 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















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















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Ct5R,Aj4qtmpVFNGOlwVDE2,iqIT0GVFIrD3 2,zO ch
bVo 4BoX,PeMj6UeVxfcKWH0p,q N0B2B,x7093zvJj 7C bz5,TW,TnsAgdfgo

Popular posts from this blog

How to check contact read email or not when send email to Individual?

How many registers does an x86_64 CPU actually have?

Displaying single band from multi-band raster using QGIS