Unable to set the correct date



  • I turned off on my Omega-2 the function of automatically adjusting the date and time on purpose. When I change the date, the month for some reason changes to February.
    date +%d%m%y -s 070419
    070219
      How to fix it?



  • @CAP-33 Try date -s YYMMDDhhmm.ss (eg. with date command of BusyBox v1.28.3).

    date -s 1904071301.00
    Sun Apr 7 13:01:00 GMT 2019


    If the date command of BusyBox is not enough for you 😉 then install the coreutils-date package - it's theoretically a full version of the standard GNU date utility.
    (As you know well: enable the 5th line of '/etc/opkg/distfeeds.conf', opkg update and opkg install coreutils-date.)

    date -s '19-04-07'
    Sun Apr 7 00:00:00 GMT 2019

    To change only the date you can use shell command substitution in the date string:
    date -s "19-04-07 $(date +%H:%M:%S)"
    it will change the date and keep the time.

    # Omega2 Pro (light) FW v0.3.2 b218
    
    root@Omega-5BE1:/# date -s '19-04-07 13:01:00'
    Sun Apr  7 13:01:00 GMT 2019
    root@Omega-5BE1:/# date
    Sun Apr  7 13:01:02 GMT 2019
    root@Omega-5BE1:/# date -s '19-04-07'
    Sun Apr  7 00:00:00 GMT 2019
    root@Omega-5BE1:/# date
    Sun Apr  7 00:00:02 GMT 2019
    
    
    root@Omega-5BE1:/# date -s '19-04-07 13:01:00'
    Sun Apr  7 13:01:00 GMT 2019
    root@Omega-5BE1:/# date
    Sun Apr  7 13:01:02 GMT 2019
    root@Omega-5BE1:/# date -s "19-04-07 $(date +%H:%M:%S)"
    Sun Apr  7 13:02:21 GMT 2019
    root@Omega-5BE1:/# date
    Sun Apr  7 13:02:09 GMT 2019
    

Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.