Variable in Date command

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












2















I want to use a variable inside date command . GNU date is not supportable in my system.
I use Sunos and when I use date with -d option it is shwoing -d as bad substitution.



#!/usr/bin/ksh
RELEASE_DATE="28 OCT 2018"
RELEASE_DATE_MINUS_2=`date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d'`
echo "Release is $RELEASE_DATE"
echo "release_date-2 is $RELEASE_DATE_MINUS_2


I have tried the above code snippet.
I should pass the actual release_date which i get it form another .cnf file
like 28OCT2018 with this input I should get two days before that date like 2018-10-26.










share|improve this question



















  • 1





    What language is rel_date a variable in?

    – Jesse_b
    Jan 7 at 13:56











  • Will your input date always be in the same format? Also will it pad day numbers less than 10? ie 2019JAN07 or 2019JAN7?

    – Jesse_b
    Jan 7 at 14:03











  • What OS and/or Distribution is this running on? (Do you have GNU date?)

    – roaima
    Jan 7 at 14:08






  • 3





    "I have used various date command features" care to share which ones you've tried, and how? Or do we need to guess?

    – roaima
    Jan 7 at 14:08






  • 2





    "I am getting the error in stating -d option is not a valid argument." What command did you use, and what was the exact error message? (Don't approximate.)

    – roaima
    Jan 7 at 14:09















2















I want to use a variable inside date command . GNU date is not supportable in my system.
I use Sunos and when I use date with -d option it is shwoing -d as bad substitution.



#!/usr/bin/ksh
RELEASE_DATE="28 OCT 2018"
RELEASE_DATE_MINUS_2=`date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d'`
echo "Release is $RELEASE_DATE"
echo "release_date-2 is $RELEASE_DATE_MINUS_2


I have tried the above code snippet.
I should pass the actual release_date which i get it form another .cnf file
like 28OCT2018 with this input I should get two days before that date like 2018-10-26.










share|improve this question



















  • 1





    What language is rel_date a variable in?

    – Jesse_b
    Jan 7 at 13:56











  • Will your input date always be in the same format? Also will it pad day numbers less than 10? ie 2019JAN07 or 2019JAN7?

    – Jesse_b
    Jan 7 at 14:03











  • What OS and/or Distribution is this running on? (Do you have GNU date?)

    – roaima
    Jan 7 at 14:08






  • 3





    "I have used various date command features" care to share which ones you've tried, and how? Or do we need to guess?

    – roaima
    Jan 7 at 14:08






  • 2





    "I am getting the error in stating -d option is not a valid argument." What command did you use, and what was the exact error message? (Don't approximate.)

    – roaima
    Jan 7 at 14:09













2












2








2








I want to use a variable inside date command . GNU date is not supportable in my system.
I use Sunos and when I use date with -d option it is shwoing -d as bad substitution.



#!/usr/bin/ksh
RELEASE_DATE="28 OCT 2018"
RELEASE_DATE_MINUS_2=`date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d'`
echo "Release is $RELEASE_DATE"
echo "release_date-2 is $RELEASE_DATE_MINUS_2


I have tried the above code snippet.
I should pass the actual release_date which i get it form another .cnf file
like 28OCT2018 with this input I should get two days before that date like 2018-10-26.










share|improve this question
















I want to use a variable inside date command . GNU date is not supportable in my system.
I use Sunos and when I use date with -d option it is shwoing -d as bad substitution.



#!/usr/bin/ksh
RELEASE_DATE="28 OCT 2018"
RELEASE_DATE_MINUS_2=`date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d'`
echo "Release is $RELEASE_DATE"
echo "release_date-2 is $RELEASE_DATE_MINUS_2


I have tried the above code snippet.
I should pass the actual release_date which i get it form another .cnf file
like 28OCT2018 with this input I should get two days before that date like 2018-10-26.







shell scripting solaris






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 11 at 11:45









chaos

35.3k773117




35.3k773117










asked Jan 7 at 13:54









SandraSandra

112




112







  • 1





    What language is rel_date a variable in?

    – Jesse_b
    Jan 7 at 13:56











  • Will your input date always be in the same format? Also will it pad day numbers less than 10? ie 2019JAN07 or 2019JAN7?

    – Jesse_b
    Jan 7 at 14:03











  • What OS and/or Distribution is this running on? (Do you have GNU date?)

    – roaima
    Jan 7 at 14:08






  • 3





    "I have used various date command features" care to share which ones you've tried, and how? Or do we need to guess?

    – roaima
    Jan 7 at 14:08






  • 2





    "I am getting the error in stating -d option is not a valid argument." What command did you use, and what was the exact error message? (Don't approximate.)

    – roaima
    Jan 7 at 14:09












  • 1





    What language is rel_date a variable in?

    – Jesse_b
    Jan 7 at 13:56











  • Will your input date always be in the same format? Also will it pad day numbers less than 10? ie 2019JAN07 or 2019JAN7?

    – Jesse_b
    Jan 7 at 14:03











  • What OS and/or Distribution is this running on? (Do you have GNU date?)

    – roaima
    Jan 7 at 14:08






  • 3





    "I have used various date command features" care to share which ones you've tried, and how? Or do we need to guess?

    – roaima
    Jan 7 at 14:08






  • 2





    "I am getting the error in stating -d option is not a valid argument." What command did you use, and what was the exact error message? (Don't approximate.)

    – roaima
    Jan 7 at 14:09







1




1





What language is rel_date a variable in?

– Jesse_b
Jan 7 at 13:56





What language is rel_date a variable in?

– Jesse_b
Jan 7 at 13:56













Will your input date always be in the same format? Also will it pad day numbers less than 10? ie 2019JAN07 or 2019JAN7?

– Jesse_b
Jan 7 at 14:03





Will your input date always be in the same format? Also will it pad day numbers less than 10? ie 2019JAN07 or 2019JAN7?

– Jesse_b
Jan 7 at 14:03













What OS and/or Distribution is this running on? (Do you have GNU date?)

– roaima
Jan 7 at 14:08





What OS and/or Distribution is this running on? (Do you have GNU date?)

– roaima
Jan 7 at 14:08




3




3





"I have used various date command features" care to share which ones you've tried, and how? Or do we need to guess?

– roaima
Jan 7 at 14:08





"I have used various date command features" care to share which ones you've tried, and how? Or do we need to guess?

– roaima
Jan 7 at 14:08




2




2





"I am getting the error in stating -d option is not a valid argument." What command did you use, and what was the exact error message? (Don't approximate.)

– roaima
Jan 7 at 14:09





"I am getting the error in stating -d option is not a valid argument." What command did you use, and what was the exact error message? (Don't approximate.)

– roaima
Jan 7 at 14:09










4 Answers
4






active

oldest

votes


















2














With the zsh shell:



zmodload zsh/datetime
rel_date=2018OCT28
strftime -rs d %Y%b%d.%H $rel_date.12 &&
strftime -s two_days_before %Y-%m-%d $((d - 86400*2)) || exit

echo $two_days_before





share|improve this answer
































    1














    You tagged this with shell so I will assume the variable is supposed to be in shell but FYI you cannot have spaces around the = for a shell variable.



    GNU date will not accept your input date in that format but will accept it like 28 OCT 2018 so using shell parameter expansion we can rearrange the date (as long as it will always be in the same format):



    date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4"


    Now in order to subtract 2 days we simply need to add:



    date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4 - 2 days" 


    And to have it output in your requested format



    date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4 - 2 days" '+%Y-%m-%d'





    share|improve this answer

























    • We don't (yet) know for sure the OP is using GNU date.

      – roaima
      Jan 7 at 14:12











    • We don't but I have provided a GNU date solution.

      – Jesse_b
      Jan 7 at 14:12











    • Hi Jess, Thanks for your help. But even this seems to be not working .

      – Sandra
      Jan 8 at 14:18











    • It just tells the same bad substitution error . Below is my code snipet.

      – Sandra
      Jan 8 at 14:18











    • #!/usr/bin/ksh RELEASE_DATE="28 OCT 2018" RELEASE_DATE_MINUS_2=date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d' echo "Release is $RELEASE_DATE" echo "releasE_date-2 is $RELEASE_DATE_MINUS_2"

      – Sandra
      Jan 8 at 14:19



















    1














    Perl can be useful for this:



    perl -MTime::Piece -slE 'say +(Time::Piece->strptime($date, "%Y%b%d") - 2 * 86_400)->ymd' -- -date="$rel_date"


    You specify the format of the incoming date variable to parse it into a time object, do the date arithmetic, then output into the desired YYYYY-mm-dd format.



    Documented here: https://perldoc.perl.org/Time/Piece.html






    share|improve this answer






























      0














      It could be useful to know which ksh88,93 are you using.



      According to ksh93(1) you can find something about date:



       printf format [ arg ... ]
      %(date-format)T


      --practical example



      : printf "%(%d.%m,%Y)Tn" 
      11.01,2019
      : printf "%(%d.%m.%Y)Tn" "2 days ago"
      09.01.2019


      Let's hope it helps you.






      share|improve this answer






















        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',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        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%2f492998%2fvariable-in-date-command%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2














        With the zsh shell:



        zmodload zsh/datetime
        rel_date=2018OCT28
        strftime -rs d %Y%b%d.%H $rel_date.12 &&
        strftime -s two_days_before %Y-%m-%d $((d - 86400*2)) || exit

        echo $two_days_before





        share|improve this answer





























          2














          With the zsh shell:



          zmodload zsh/datetime
          rel_date=2018OCT28
          strftime -rs d %Y%b%d.%H $rel_date.12 &&
          strftime -s two_days_before %Y-%m-%d $((d - 86400*2)) || exit

          echo $two_days_before





          share|improve this answer



























            2












            2








            2







            With the zsh shell:



            zmodload zsh/datetime
            rel_date=2018OCT28
            strftime -rs d %Y%b%d.%H $rel_date.12 &&
            strftime -s two_days_before %Y-%m-%d $((d - 86400*2)) || exit

            echo $two_days_before





            share|improve this answer















            With the zsh shell:



            zmodload zsh/datetime
            rel_date=2018OCT28
            strftime -rs d %Y%b%d.%H $rel_date.12 &&
            strftime -s two_days_before %Y-%m-%d $((d - 86400*2)) || exit

            echo $two_days_before






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 7 at 14:22

























            answered Jan 7 at 14:17









            Stéphane ChazelasStéphane Chazelas

            301k55566918




            301k55566918























                1














                You tagged this with shell so I will assume the variable is supposed to be in shell but FYI you cannot have spaces around the = for a shell variable.



                GNU date will not accept your input date in that format but will accept it like 28 OCT 2018 so using shell parameter expansion we can rearrange the date (as long as it will always be in the same format):



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4"


                Now in order to subtract 2 days we simply need to add:



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4 - 2 days" 


                And to have it output in your requested format



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4 - 2 days" '+%Y-%m-%d'





                share|improve this answer

























                • We don't (yet) know for sure the OP is using GNU date.

                  – roaima
                  Jan 7 at 14:12











                • We don't but I have provided a GNU date solution.

                  – Jesse_b
                  Jan 7 at 14:12











                • Hi Jess, Thanks for your help. But even this seems to be not working .

                  – Sandra
                  Jan 8 at 14:18











                • It just tells the same bad substitution error . Below is my code snipet.

                  – Sandra
                  Jan 8 at 14:18











                • #!/usr/bin/ksh RELEASE_DATE="28 OCT 2018" RELEASE_DATE_MINUS_2=date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d' echo "Release is $RELEASE_DATE" echo "releasE_date-2 is $RELEASE_DATE_MINUS_2"

                  – Sandra
                  Jan 8 at 14:19
















                1














                You tagged this with shell so I will assume the variable is supposed to be in shell but FYI you cannot have spaces around the = for a shell variable.



                GNU date will not accept your input date in that format but will accept it like 28 OCT 2018 so using shell parameter expansion we can rearrange the date (as long as it will always be in the same format):



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4"


                Now in order to subtract 2 days we simply need to add:



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4 - 2 days" 


                And to have it output in your requested format



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4 - 2 days" '+%Y-%m-%d'





                share|improve this answer

























                • We don't (yet) know for sure the OP is using GNU date.

                  – roaima
                  Jan 7 at 14:12











                • We don't but I have provided a GNU date solution.

                  – Jesse_b
                  Jan 7 at 14:12











                • Hi Jess, Thanks for your help. But even this seems to be not working .

                  – Sandra
                  Jan 8 at 14:18











                • It just tells the same bad substitution error . Below is my code snipet.

                  – Sandra
                  Jan 8 at 14:18











                • #!/usr/bin/ksh RELEASE_DATE="28 OCT 2018" RELEASE_DATE_MINUS_2=date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d' echo "Release is $RELEASE_DATE" echo "releasE_date-2 is $RELEASE_DATE_MINUS_2"

                  – Sandra
                  Jan 8 at 14:19














                1












                1








                1







                You tagged this with shell so I will assume the variable is supposed to be in shell but FYI you cannot have spaces around the = for a shell variable.



                GNU date will not accept your input date in that format but will accept it like 28 OCT 2018 so using shell parameter expansion we can rearrange the date (as long as it will always be in the same format):



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4"


                Now in order to subtract 2 days we simply need to add:



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4 - 2 days" 


                And to have it output in your requested format



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4 - 2 days" '+%Y-%m-%d'





                share|improve this answer















                You tagged this with shell so I will assume the variable is supposed to be in shell but FYI you cannot have spaces around the = for a shell variable.



                GNU date will not accept your input date in that format but will accept it like 28 OCT 2018 so using shell parameter expansion we can rearrange the date (as long as it will always be in the same format):



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4"


                Now in order to subtract 2 days we simply need to add:



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4 - 2 days" 


                And to have it output in your requested format



                date -d "$rel_date: -2 $rel_date:4:3 $rel_date:0:4 - 2 days" '+%Y-%m-%d'






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 7 at 14:18

























                answered Jan 7 at 14:11









                Jesse_bJesse_b

                12.1k23064




                12.1k23064












                • We don't (yet) know for sure the OP is using GNU date.

                  – roaima
                  Jan 7 at 14:12











                • We don't but I have provided a GNU date solution.

                  – Jesse_b
                  Jan 7 at 14:12











                • Hi Jess, Thanks for your help. But even this seems to be not working .

                  – Sandra
                  Jan 8 at 14:18











                • It just tells the same bad substitution error . Below is my code snipet.

                  – Sandra
                  Jan 8 at 14:18











                • #!/usr/bin/ksh RELEASE_DATE="28 OCT 2018" RELEASE_DATE_MINUS_2=date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d' echo "Release is $RELEASE_DATE" echo "releasE_date-2 is $RELEASE_DATE_MINUS_2"

                  – Sandra
                  Jan 8 at 14:19


















                • We don't (yet) know for sure the OP is using GNU date.

                  – roaima
                  Jan 7 at 14:12











                • We don't but I have provided a GNU date solution.

                  – Jesse_b
                  Jan 7 at 14:12











                • Hi Jess, Thanks for your help. But even this seems to be not working .

                  – Sandra
                  Jan 8 at 14:18











                • It just tells the same bad substitution error . Below is my code snipet.

                  – Sandra
                  Jan 8 at 14:18











                • #!/usr/bin/ksh RELEASE_DATE="28 OCT 2018" RELEASE_DATE_MINUS_2=date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d' echo "Release is $RELEASE_DATE" echo "releasE_date-2 is $RELEASE_DATE_MINUS_2"

                  – Sandra
                  Jan 8 at 14:19

















                We don't (yet) know for sure the OP is using GNU date.

                – roaima
                Jan 7 at 14:12





                We don't (yet) know for sure the OP is using GNU date.

                – roaima
                Jan 7 at 14:12













                We don't but I have provided a GNU date solution.

                – Jesse_b
                Jan 7 at 14:12





                We don't but I have provided a GNU date solution.

                – Jesse_b
                Jan 7 at 14:12













                Hi Jess, Thanks for your help. But even this seems to be not working .

                – Sandra
                Jan 8 at 14:18





                Hi Jess, Thanks for your help. But even this seems to be not working .

                – Sandra
                Jan 8 at 14:18













                It just tells the same bad substitution error . Below is my code snipet.

                – Sandra
                Jan 8 at 14:18





                It just tells the same bad substitution error . Below is my code snipet.

                – Sandra
                Jan 8 at 14:18













                #!/usr/bin/ksh RELEASE_DATE="28 OCT 2018" RELEASE_DATE_MINUS_2=date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d' echo "Release is $RELEASE_DATE" echo "releasE_date-2 is $RELEASE_DATE_MINUS_2"

                – Sandra
                Jan 8 at 14:19






                #!/usr/bin/ksh RELEASE_DATE="28 OCT 2018" RELEASE_DATE_MINUS_2=date -"$RELEASE_DATE: -2 $RELEASE_DATE:4:3 $RELEASE_DATE:0:4 - 2 days" '+%Y-%m-%d' echo "Release is $RELEASE_DATE" echo "releasE_date-2 is $RELEASE_DATE_MINUS_2"

                – Sandra
                Jan 8 at 14:19












                1














                Perl can be useful for this:



                perl -MTime::Piece -slE 'say +(Time::Piece->strptime($date, "%Y%b%d") - 2 * 86_400)->ymd' -- -date="$rel_date"


                You specify the format of the incoming date variable to parse it into a time object, do the date arithmetic, then output into the desired YYYYY-mm-dd format.



                Documented here: https://perldoc.perl.org/Time/Piece.html






                share|improve this answer



























                  1














                  Perl can be useful for this:



                  perl -MTime::Piece -slE 'say +(Time::Piece->strptime($date, "%Y%b%d") - 2 * 86_400)->ymd' -- -date="$rel_date"


                  You specify the format of the incoming date variable to parse it into a time object, do the date arithmetic, then output into the desired YYYYY-mm-dd format.



                  Documented here: https://perldoc.perl.org/Time/Piece.html






                  share|improve this answer

























                    1












                    1








                    1







                    Perl can be useful for this:



                    perl -MTime::Piece -slE 'say +(Time::Piece->strptime($date, "%Y%b%d") - 2 * 86_400)->ymd' -- -date="$rel_date"


                    You specify the format of the incoming date variable to parse it into a time object, do the date arithmetic, then output into the desired YYYYY-mm-dd format.



                    Documented here: https://perldoc.perl.org/Time/Piece.html






                    share|improve this answer













                    Perl can be useful for this:



                    perl -MTime::Piece -slE 'say +(Time::Piece->strptime($date, "%Y%b%d") - 2 * 86_400)->ymd' -- -date="$rel_date"


                    You specify the format of the incoming date variable to parse it into a time object, do the date arithmetic, then output into the desired YYYYY-mm-dd format.



                    Documented here: https://perldoc.perl.org/Time/Piece.html







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 7 at 17:58









                    glenn jackmanglenn jackman

                    51k571110




                    51k571110





















                        0














                        It could be useful to know which ksh88,93 are you using.



                        According to ksh93(1) you can find something about date:



                         printf format [ arg ... ]
                        %(date-format)T


                        --practical example



                        : printf "%(%d.%m,%Y)Tn" 
                        11.01,2019
                        : printf "%(%d.%m.%Y)Tn" "2 days ago"
                        09.01.2019


                        Let's hope it helps you.






                        share|improve this answer



























                          0














                          It could be useful to know which ksh88,93 are you using.



                          According to ksh93(1) you can find something about date:



                           printf format [ arg ... ]
                          %(date-format)T


                          --practical example



                          : printf "%(%d.%m,%Y)Tn" 
                          11.01,2019
                          : printf "%(%d.%m.%Y)Tn" "2 days ago"
                          09.01.2019


                          Let's hope it helps you.






                          share|improve this answer

























                            0












                            0








                            0







                            It could be useful to know which ksh88,93 are you using.



                            According to ksh93(1) you can find something about date:



                             printf format [ arg ... ]
                            %(date-format)T


                            --practical example



                            : printf "%(%d.%m,%Y)Tn" 
                            11.01,2019
                            : printf "%(%d.%m.%Y)Tn" "2 days ago"
                            09.01.2019


                            Let's hope it helps you.






                            share|improve this answer













                            It could be useful to know which ksh88,93 are you using.



                            According to ksh93(1) you can find something about date:



                             printf format [ arg ... ]
                            %(date-format)T


                            --practical example



                            : printf "%(%d.%m,%Y)Tn" 
                            11.01,2019
                            : printf "%(%d.%m.%Y)Tn" "2 days ago"
                            09.01.2019


                            Let's hope it helps you.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jan 11 at 20:19









                            tntxtntx

                            642




                            642



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f492998%2fvariable-in-date-command%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown






                                Popular posts from this blog

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

                                Displaying single band from multi-band raster using QGIS

                                How many registers does an x86_64 CPU actually have?