Invalid date error by date command The Next CEO of Stack OverflowHow can I change the default date output format for the date command?Date format in UNIXHaving problem displaying date?Change “date” Command To 12 Hour Time Instead Of 24how to fix odd date (commandline command) formatDate off by years - Cannot set dateFrom where `date` retrieve date?Passing a date in an exiftool commandHow to use “date” command parametersWhat is the date command line corresponding to var=“$(date +”%x %r %Z“)”

Why did we only see the N-1 starfighters in one film?

How do you know when two objects are so called entangled?

How to count occurrences of text in a file?

How to start emacs in "nothing" mode (`fundamental-mode`)

What flight has the highest ratio of time difference to flight time?

Clustering points and summing up attributes per cluster in QGIS

Can the Reverse Gravity spell affect the Meteor Swarm spell?

IPsec : transmission of Initialization Vector

How can I quit an app using Terminal?

Indicator light circuit

How do scammers retract money, while you can’t?

Can I equip Skullclamp on a creature I am sacrificing?

Why is there a PLL in CPU?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

How do I construct this japanese bowl?

Robert Sheckley short story about vacation spots being overwhelmed

Why does standard notation not preserve intervals (visually)

What can we do to stop prior company from asking us questions?

How to make a software documentation "officially" citable?

What do "high sea" and "carry" mean in this sentence?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

Tiptoe or tiphoof? Adjusting words to better fit fantasy races

How to prepend a string to only the lines of text which are numbers

Reduce array of object to totals by property object



Invalid date error by date command



The Next CEO of Stack OverflowHow can I change the default date output format for the date command?Date format in UNIXHaving problem displaying date?Change “date” Command To 12 Hour Time Instead Of 24how to fix odd date (commandline command) formatDate off by years - Cannot set dateFrom where `date` retrieve date?Passing a date in an exiftool commandHow to use “date” command parametersWhat is the date command line corresponding to var=“$(date +”%x %r %Z“)”










7















I want to get the date information with this command:



date --date=2019-03-22


or



date --date=2019/03/22


but it shows this error:



date: invalid date ‘2019-03-22’


or



 date: invalid date ‘2019/03/22’


as you can see it is not related to dash. the same thing happens with slash.



When I use another date like



date --date=2019-03-21


It shows the information correctly.



It shouldn't be related to the bad dash character. because I just deleted the last 2 and replaced it with 1 and the output is OK.



What is going wrong?



Result of some commands for more information:



$ date --version
date (GNU coreutils) 8.28
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.


$ type -a date
date is /bin/date


$ uname -m
x86_64


$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic


$ which date
/bin/date


$ apt-cache policy coreutils
coreutils:
Installed: 8.28-1ubuntu1
Candidate: 8.28-1ubuntu1
Version table:
*** 8.28-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status


$ date
Fri Mar 22 06:54:59 PDT 2019


date --date=2019-03-22 2>&1 | od -c
0000000 d a t e : i n v a l i d d a
0000020 t e 342 200 230 2 0 1 9 - 0 3 - 2 2
0000040 342 200 231 n
0000044


Something weird going on with different timezone in this date: 2019-03-22. I randomly changed timezone to different areas. Some of them have errors, some of them not! When I select these I have problem with that specific date:



  • Los Angeles (USA)

  • Shanghai (China)

  • Madrid (Spain)

  • Tehran (Iran)









share|improve this question
























  • Comments are not for extended discussion; this conversation has been moved to chat.

    – Thomas Ward
    Mar 22 at 17:10















7















I want to get the date information with this command:



date --date=2019-03-22


or



date --date=2019/03/22


but it shows this error:



date: invalid date ‘2019-03-22’


or



 date: invalid date ‘2019/03/22’


as you can see it is not related to dash. the same thing happens with slash.



When I use another date like



date --date=2019-03-21


It shows the information correctly.



It shouldn't be related to the bad dash character. because I just deleted the last 2 and replaced it with 1 and the output is OK.



What is going wrong?



Result of some commands for more information:



$ date --version
date (GNU coreutils) 8.28
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.


$ type -a date
date is /bin/date


$ uname -m
x86_64


$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic


$ which date
/bin/date


$ apt-cache policy coreutils
coreutils:
Installed: 8.28-1ubuntu1
Candidate: 8.28-1ubuntu1
Version table:
*** 8.28-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status


$ date
Fri Mar 22 06:54:59 PDT 2019


date --date=2019-03-22 2>&1 | od -c
0000000 d a t e : i n v a l i d d a
0000020 t e 342 200 230 2 0 1 9 - 0 3 - 2 2
0000040 342 200 231 n
0000044


Something weird going on with different timezone in this date: 2019-03-22. I randomly changed timezone to different areas. Some of them have errors, some of them not! When I select these I have problem with that specific date:



  • Los Angeles (USA)

  • Shanghai (China)

  • Madrid (Spain)

  • Tehran (Iran)









share|improve this question
























  • Comments are not for extended discussion; this conversation has been moved to chat.

    – Thomas Ward
    Mar 22 at 17:10













7












7








7








I want to get the date information with this command:



date --date=2019-03-22


or



date --date=2019/03/22


but it shows this error:



date: invalid date ‘2019-03-22’


or



 date: invalid date ‘2019/03/22’


as you can see it is not related to dash. the same thing happens with slash.



When I use another date like



date --date=2019-03-21


It shows the information correctly.



It shouldn't be related to the bad dash character. because I just deleted the last 2 and replaced it with 1 and the output is OK.



What is going wrong?



Result of some commands for more information:



$ date --version
date (GNU coreutils) 8.28
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.


$ type -a date
date is /bin/date


$ uname -m
x86_64


$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic


$ which date
/bin/date


$ apt-cache policy coreutils
coreutils:
Installed: 8.28-1ubuntu1
Candidate: 8.28-1ubuntu1
Version table:
*** 8.28-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status


$ date
Fri Mar 22 06:54:59 PDT 2019


date --date=2019-03-22 2>&1 | od -c
0000000 d a t e : i n v a l i d d a
0000020 t e 342 200 230 2 0 1 9 - 0 3 - 2 2
0000040 342 200 231 n
0000044


Something weird going on with different timezone in this date: 2019-03-22. I randomly changed timezone to different areas. Some of them have errors, some of them not! When I select these I have problem with that specific date:



  • Los Angeles (USA)

  • Shanghai (China)

  • Madrid (Spain)

  • Tehran (Iran)









share|improve this question
















I want to get the date information with this command:



date --date=2019-03-22


or



date --date=2019/03/22


but it shows this error:



date: invalid date ‘2019-03-22’


or



 date: invalid date ‘2019/03/22’


as you can see it is not related to dash. the same thing happens with slash.



When I use another date like



date --date=2019-03-21


It shows the information correctly.



It shouldn't be related to the bad dash character. because I just deleted the last 2 and replaced it with 1 and the output is OK.



What is going wrong?



Result of some commands for more information:



$ date --version
date (GNU coreutils) 8.28
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.


$ type -a date
date is /bin/date


$ uname -m
x86_64


$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic


$ which date
/bin/date


$ apt-cache policy coreutils
coreutils:
Installed: 8.28-1ubuntu1
Candidate: 8.28-1ubuntu1
Version table:
*** 8.28-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status


$ date
Fri Mar 22 06:54:59 PDT 2019


date --date=2019-03-22 2>&1 | od -c
0000000 d a t e : i n v a l i d d a
0000020 t e 342 200 230 2 0 1 9 - 0 3 - 2 2
0000040 342 200 231 n
0000044


Something weird going on with different timezone in this date: 2019-03-22. I randomly changed timezone to different areas. Some of them have errors, some of them not! When I select these I have problem with that specific date:



  • Los Angeles (USA)

  • Shanghai (China)

  • Madrid (Spain)

  • Tehran (Iran)






command-line date






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 13:29







ICE

















asked Mar 22 at 13:20









ICEICE

8523724




8523724












  • Comments are not for extended discussion; this conversation has been moved to chat.

    – Thomas Ward
    Mar 22 at 17:10

















  • Comments are not for extended discussion; this conversation has been moved to chat.

    – Thomas Ward
    Mar 22 at 17:10
















Comments are not for extended discussion; this conversation has been moved to chat.

– Thomas Ward
Mar 22 at 17:10





Comments are not for extended discussion; this conversation has been moved to chat.

– Thomas Ward
Mar 22 at 17:10










2 Answers
2






active

oldest

votes


















5














I'm almost sure this is due to the changeover to Daylight Saving Time in the given timezone: effectively this means that an hour "disappears" (and hence becomes "invalid").



In my own timezone, DST started at 2AM on Sunday 10th March, so that hour is invalid:



$ cat /etc/timezone
America/Toronto
$ date --date="2019-03-10 02:00:00"
date: invalid date ‘2019-03-10 02:00:00’


whereas the times immediately before and after are valid:



$ date --date="2019-03-10 01:59:59"
Sun Mar 10 01:59:59 EST 2019

$ date --date="2019-03-10 03:00:00"
Sun Mar 10 03:00:00 EDT 2019


In timezones where the change over happens at midnight, the bare date appears invalid because GNU date assumes a time of midnight:



$ TZ=Asia/Tehran date --date='2019-03-22'
date: invalid date ‘2019-03-22’


but one hour later is valid:



$ TZ=Asia/Tehran date --date='2019-03-22 01:00:00'
Fri Mar 22 01:00:00 +0430 2019


See also Invalid Date Linux






share|improve this answer

























  • Thanks, adding time to date fixed the problem.

    – ICE
    Mar 22 at 19:45












  • They "change to daylight saving at midnight" should not be a problem for 2019-03-22 as the users TZ is currently PDT.

    – glenn jackman
    Mar 22 at 20:12











  • reinstalling tzdata package fixed the problem for me. Now only one timezone has error as you explained in your answer without adding time. I don't know what went wrong with tzdata package but even TZ=America/Toronto date --date="2019-03-10 02:00:00" returned the result without error before reinstalling the tzdata package. thank you for your time.

    – ICE
    Mar 23 at 0:49



















4














$ date_ascii="2019-03-22"
$ printf "%s" "$date_ascii" | od -c
0000000 2 0 1 9 - 0 3 - 2 2
0000012
$ TZ=Asia/Shanghai date -d "$date_ascii"
Fri Mar 22 00:00:00 America 2019


and



$ date_unicode="2019‑03‑22"
$ printf "%s" "$date_unicode" | od -c
0000000 2 0 1 9 342 200 221 0 3 342 200 221 2 2
0000016
$ TZ=Asia/Shanghai date -d "$date_unicode"
date: invalid date ‘2019‑03‑22’





share|improve this answer























  • Seems There is something wrong with timezone in my system :(

    – ICE
    Mar 22 at 15:18






  • 1





    you should reinstall the tzdata package.

    – glenn jackman
    Mar 22 at 20:09












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2faskubuntu.com%2fquestions%2f1127834%2finvalid-date-error-by-date-command%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














I'm almost sure this is due to the changeover to Daylight Saving Time in the given timezone: effectively this means that an hour "disappears" (and hence becomes "invalid").



In my own timezone, DST started at 2AM on Sunday 10th March, so that hour is invalid:



$ cat /etc/timezone
America/Toronto
$ date --date="2019-03-10 02:00:00"
date: invalid date ‘2019-03-10 02:00:00’


whereas the times immediately before and after are valid:



$ date --date="2019-03-10 01:59:59"
Sun Mar 10 01:59:59 EST 2019

$ date --date="2019-03-10 03:00:00"
Sun Mar 10 03:00:00 EDT 2019


In timezones where the change over happens at midnight, the bare date appears invalid because GNU date assumes a time of midnight:



$ TZ=Asia/Tehran date --date='2019-03-22'
date: invalid date ‘2019-03-22’


but one hour later is valid:



$ TZ=Asia/Tehran date --date='2019-03-22 01:00:00'
Fri Mar 22 01:00:00 +0430 2019


See also Invalid Date Linux






share|improve this answer

























  • Thanks, adding time to date fixed the problem.

    – ICE
    Mar 22 at 19:45












  • They "change to daylight saving at midnight" should not be a problem for 2019-03-22 as the users TZ is currently PDT.

    – glenn jackman
    Mar 22 at 20:12











  • reinstalling tzdata package fixed the problem for me. Now only one timezone has error as you explained in your answer without adding time. I don't know what went wrong with tzdata package but even TZ=America/Toronto date --date="2019-03-10 02:00:00" returned the result without error before reinstalling the tzdata package. thank you for your time.

    – ICE
    Mar 23 at 0:49
















5














I'm almost sure this is due to the changeover to Daylight Saving Time in the given timezone: effectively this means that an hour "disappears" (and hence becomes "invalid").



In my own timezone, DST started at 2AM on Sunday 10th March, so that hour is invalid:



$ cat /etc/timezone
America/Toronto
$ date --date="2019-03-10 02:00:00"
date: invalid date ‘2019-03-10 02:00:00’


whereas the times immediately before and after are valid:



$ date --date="2019-03-10 01:59:59"
Sun Mar 10 01:59:59 EST 2019

$ date --date="2019-03-10 03:00:00"
Sun Mar 10 03:00:00 EDT 2019


In timezones where the change over happens at midnight, the bare date appears invalid because GNU date assumes a time of midnight:



$ TZ=Asia/Tehran date --date='2019-03-22'
date: invalid date ‘2019-03-22’


but one hour later is valid:



$ TZ=Asia/Tehran date --date='2019-03-22 01:00:00'
Fri Mar 22 01:00:00 +0430 2019


See also Invalid Date Linux






share|improve this answer

























  • Thanks, adding time to date fixed the problem.

    – ICE
    Mar 22 at 19:45












  • They "change to daylight saving at midnight" should not be a problem for 2019-03-22 as the users TZ is currently PDT.

    – glenn jackman
    Mar 22 at 20:12











  • reinstalling tzdata package fixed the problem for me. Now only one timezone has error as you explained in your answer without adding time. I don't know what went wrong with tzdata package but even TZ=America/Toronto date --date="2019-03-10 02:00:00" returned the result without error before reinstalling the tzdata package. thank you for your time.

    – ICE
    Mar 23 at 0:49














5












5








5







I'm almost sure this is due to the changeover to Daylight Saving Time in the given timezone: effectively this means that an hour "disappears" (and hence becomes "invalid").



In my own timezone, DST started at 2AM on Sunday 10th March, so that hour is invalid:



$ cat /etc/timezone
America/Toronto
$ date --date="2019-03-10 02:00:00"
date: invalid date ‘2019-03-10 02:00:00’


whereas the times immediately before and after are valid:



$ date --date="2019-03-10 01:59:59"
Sun Mar 10 01:59:59 EST 2019

$ date --date="2019-03-10 03:00:00"
Sun Mar 10 03:00:00 EDT 2019


In timezones where the change over happens at midnight, the bare date appears invalid because GNU date assumes a time of midnight:



$ TZ=Asia/Tehran date --date='2019-03-22'
date: invalid date ‘2019-03-22’


but one hour later is valid:



$ TZ=Asia/Tehran date --date='2019-03-22 01:00:00'
Fri Mar 22 01:00:00 +0430 2019


See also Invalid Date Linux






share|improve this answer















I'm almost sure this is due to the changeover to Daylight Saving Time in the given timezone: effectively this means that an hour "disappears" (and hence becomes "invalid").



In my own timezone, DST started at 2AM on Sunday 10th March, so that hour is invalid:



$ cat /etc/timezone
America/Toronto
$ date --date="2019-03-10 02:00:00"
date: invalid date ‘2019-03-10 02:00:00’


whereas the times immediately before and after are valid:



$ date --date="2019-03-10 01:59:59"
Sun Mar 10 01:59:59 EST 2019

$ date --date="2019-03-10 03:00:00"
Sun Mar 10 03:00:00 EDT 2019


In timezones where the change over happens at midnight, the bare date appears invalid because GNU date assumes a time of midnight:



$ TZ=Asia/Tehran date --date='2019-03-22'
date: invalid date ‘2019-03-22’


but one hour later is valid:



$ TZ=Asia/Tehran date --date='2019-03-22 01:00:00'
Fri Mar 22 01:00:00 +0430 2019


See also Invalid Date Linux







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 22 at 20:44

























answered Mar 22 at 19:00









steeldriversteeldriver

70.4k11114187




70.4k11114187












  • Thanks, adding time to date fixed the problem.

    – ICE
    Mar 22 at 19:45












  • They "change to daylight saving at midnight" should not be a problem for 2019-03-22 as the users TZ is currently PDT.

    – glenn jackman
    Mar 22 at 20:12











  • reinstalling tzdata package fixed the problem for me. Now only one timezone has error as you explained in your answer without adding time. I don't know what went wrong with tzdata package but even TZ=America/Toronto date --date="2019-03-10 02:00:00" returned the result without error before reinstalling the tzdata package. thank you for your time.

    – ICE
    Mar 23 at 0:49


















  • Thanks, adding time to date fixed the problem.

    – ICE
    Mar 22 at 19:45












  • They "change to daylight saving at midnight" should not be a problem for 2019-03-22 as the users TZ is currently PDT.

    – glenn jackman
    Mar 22 at 20:12











  • reinstalling tzdata package fixed the problem for me. Now only one timezone has error as you explained in your answer without adding time. I don't know what went wrong with tzdata package but even TZ=America/Toronto date --date="2019-03-10 02:00:00" returned the result without error before reinstalling the tzdata package. thank you for your time.

    – ICE
    Mar 23 at 0:49

















Thanks, adding time to date fixed the problem.

– ICE
Mar 22 at 19:45






Thanks, adding time to date fixed the problem.

– ICE
Mar 22 at 19:45














They "change to daylight saving at midnight" should not be a problem for 2019-03-22 as the users TZ is currently PDT.

– glenn jackman
Mar 22 at 20:12





They "change to daylight saving at midnight" should not be a problem for 2019-03-22 as the users TZ is currently PDT.

– glenn jackman
Mar 22 at 20:12













reinstalling tzdata package fixed the problem for me. Now only one timezone has error as you explained in your answer without adding time. I don't know what went wrong with tzdata package but even TZ=America/Toronto date --date="2019-03-10 02:00:00" returned the result without error before reinstalling the tzdata package. thank you for your time.

– ICE
Mar 23 at 0:49






reinstalling tzdata package fixed the problem for me. Now only one timezone has error as you explained in your answer without adding time. I don't know what went wrong with tzdata package but even TZ=America/Toronto date --date="2019-03-10 02:00:00" returned the result without error before reinstalling the tzdata package. thank you for your time.

– ICE
Mar 23 at 0:49














4














$ date_ascii="2019-03-22"
$ printf "%s" "$date_ascii" | od -c
0000000 2 0 1 9 - 0 3 - 2 2
0000012
$ TZ=Asia/Shanghai date -d "$date_ascii"
Fri Mar 22 00:00:00 America 2019


and



$ date_unicode="2019‑03‑22"
$ printf "%s" "$date_unicode" | od -c
0000000 2 0 1 9 342 200 221 0 3 342 200 221 2 2
0000016
$ TZ=Asia/Shanghai date -d "$date_unicode"
date: invalid date ‘2019‑03‑22’





share|improve this answer























  • Seems There is something wrong with timezone in my system :(

    – ICE
    Mar 22 at 15:18






  • 1





    you should reinstall the tzdata package.

    – glenn jackman
    Mar 22 at 20:09
















4














$ date_ascii="2019-03-22"
$ printf "%s" "$date_ascii" | od -c
0000000 2 0 1 9 - 0 3 - 2 2
0000012
$ TZ=Asia/Shanghai date -d "$date_ascii"
Fri Mar 22 00:00:00 America 2019


and



$ date_unicode="2019‑03‑22"
$ printf "%s" "$date_unicode" | od -c
0000000 2 0 1 9 342 200 221 0 3 342 200 221 2 2
0000016
$ TZ=Asia/Shanghai date -d "$date_unicode"
date: invalid date ‘2019‑03‑22’





share|improve this answer























  • Seems There is something wrong with timezone in my system :(

    – ICE
    Mar 22 at 15:18






  • 1





    you should reinstall the tzdata package.

    – glenn jackman
    Mar 22 at 20:09














4












4








4







$ date_ascii="2019-03-22"
$ printf "%s" "$date_ascii" | od -c
0000000 2 0 1 9 - 0 3 - 2 2
0000012
$ TZ=Asia/Shanghai date -d "$date_ascii"
Fri Mar 22 00:00:00 America 2019


and



$ date_unicode="2019‑03‑22"
$ printf "%s" "$date_unicode" | od -c
0000000 2 0 1 9 342 200 221 0 3 342 200 221 2 2
0000016
$ TZ=Asia/Shanghai date -d "$date_unicode"
date: invalid date ‘2019‑03‑22’





share|improve this answer













$ date_ascii="2019-03-22"
$ printf "%s" "$date_ascii" | od -c
0000000 2 0 1 9 - 0 3 - 2 2
0000012
$ TZ=Asia/Shanghai date -d "$date_ascii"
Fri Mar 22 00:00:00 America 2019


and



$ date_unicode="2019‑03‑22"
$ printf "%s" "$date_unicode" | od -c
0000000 2 0 1 9 342 200 221 0 3 342 200 221 2 2
0000016
$ TZ=Asia/Shanghai date -d "$date_unicode"
date: invalid date ‘2019‑03‑22’






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 22 at 14:59









glenn jackmanglenn jackman

12.7k2545




12.7k2545












  • Seems There is something wrong with timezone in my system :(

    – ICE
    Mar 22 at 15:18






  • 1





    you should reinstall the tzdata package.

    – glenn jackman
    Mar 22 at 20:09


















  • Seems There is something wrong with timezone in my system :(

    – ICE
    Mar 22 at 15:18






  • 1





    you should reinstall the tzdata package.

    – glenn jackman
    Mar 22 at 20:09

















Seems There is something wrong with timezone in my system :(

– ICE
Mar 22 at 15:18





Seems There is something wrong with timezone in my system :(

– ICE
Mar 22 at 15:18




1




1





you should reinstall the tzdata package.

– glenn jackman
Mar 22 at 20:09






you should reinstall the tzdata package.

– glenn jackman
Mar 22 at 20:09


















draft saved

draft discarded
















































Thanks for contributing an answer to Ask Ubuntu!


  • 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%2faskubuntu.com%2fquestions%2f1127834%2finvalid-date-error-by-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

Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?