I wanted to check how a certain software reacts when I change my computer's date. But I could not change the system time to anything less than 1970. Why is that?
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)
Since the update to 18.04 from 16.04, i see top bar with date and time only on the primary screen of my notebook. On the other screens the top bar is not shown.
Another anoying thing is i see only the actual weekday and time of the day. I would like to see the whole date with time without clicking on it...
I've searched along by google but i didnt found a solution...
I'd like to have a time, say 6:45am, and add an amount of hours, say 1.45 hours, to result in another time. So I'd like to add 1.45 hours to 6:45am to get another time.
Is there a command line utile for that? I've done some Googling, and read the man page for date
and haven't found anything like that. wcalc
doesn't seem to handle time calculations.
EDIT: Mar 6, 2015. This is the script I ended up with to use decimal hours. It could use some error checking to make sure HH:MM uses 2 digits for the hours.
#!/bin/bash
# Mar 6, 2015
# Add decimal hours to given time.
# Syntax: timeadd HH:MM HOURS
# There MUST be 2 digits for the hours in HH:MM.
# Times must be in military time.
# Ex: timeadd 05:51 4.51
# Ex: timeadd 14:12 2.05
echo " "
# If we have less than 2 parameters, show instructions and exit.
if [ $# -lt 2 ]
then
echo "Usage: timeadd HH:MM DECHOURS"
exit 1
fi
intime=$1
inhours=$2
# Below is arithmetic expansion $(())
# The bc calculator is standard on Ubuntu.
# Below rounds to the minute.
inminutes=$(echo "scale=0; ((($inhours * 60)*10)+5)/10" | bc)
echo "inminutes=$inminutes"
now=$(date -d "$intime today + $inminutes minutes" +'%H:%M')
echo "New time is $now"
I have a dual boot system with Win 7 / Ubuntu 13.04. For some reason, Ubuntu resets the system time to -3 hours regardless of timezone settings. I thought that this was UTC problem, but the problem persists regardless of what is set in /etc/default/rcS.
# assume that the BIOS clock is set to UTC time (recommended)
UTC=no
If I check the timezone with date +%Z it states
UTC
However, when using the graphical user interface to check the timezone it shows that I'm in the right timezone.
Date gives me
pe 9.8.2013 13.51.52 +0000
While hwclock is the correct time
pe 9. elokuuta 2013 16.52.03 -0.516733 sekuntia
Ubuntu seems to set the BIOS time to wrong time. This happens on every boot, even after I've manually changed the time. Windows 7 does not have this problem. I could not find duplicates or solutions beyond the UTC settings.
The system is set to manual time and is not updating it from the internet. I've already tried that but it seems that it never updates so I'm stuck in the wrong time.