0

I'm using Ubuntu 18.04 x64 on VPS, I never used it before.

I created huge nodejs script with

  • new Date().toLocaleTimeString() and new Date().toLocaleDateString

commends, on Windows 10 everything works great, but on Ubuntu because of 12 hour format my nodejs script is in total mess.

I want to change ubuntu settings instead of changing nodejs script.

I'm from Poland and I'm using 24 hour format. I already changed something :D with console command, my time in ubuntu terminal looks like this:

root@node:~# date
Thu Nov 29 16:18:24 CET 2018

root@node:~# sudo timedatectl
                      Local time: Thu 2018-11-29 16:31:15 CET
                  Universal time: Thu 2018-11-29 15:31:15 UTC
                        RTC time: Thu 2018-11-29 15:31:16
                       Time zone: Europe/Warsaw (CET, +0100)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

but in nodejs console I see:

[4:02:20 PM] 

on Windows:

[2018-11-29][14:55:01]

on Ubuntu

[11/29/2018][4:00:33 PM]

Because of symbol '/' in date on Ubuntu my script can't create new .txt files with date

Please help me :D Thank you & Greetings

1 Answer 1

0

Set shell variable LC_ALL=pl_PL.UTF-8. I tried with LC_TIME but it doesn't work.

PS: Don't mess with date, it doesn't do anything in this case (only SHOWS time)

9
  • -bash: warning: setlocale: LC_ALL: cannot change locale (pl_PL.UTF-8): No such file or directory
    – Ja Yeti
    Nov 29, 2018 at 17:29
  • oh sorry, I use german where it's de_DE. Apparently for Polish it's LC_ALL=pl Nov 29, 2018 at 17:35
  • I really don't get it, what I'm doing wrong here, should I just paste here into terminal with PuTTY? -bash: warning: setlocale: LC_ALL: cannot change locale (pl): No such file or directory
    – Ja Yeti
    Nov 29, 2018 at 18:05
  • LC_ALL=pl_PL-UTF-8 node to run only nodejs one time with LC_ALL or export LC_ALL=pl_PL-UTF-8 for the whole session (i.e. until you close the terminal window) or put LC_ALL=pl_PL-UTF-8 export LC_ALL (two separate lines) in your .bashrc for setting the variable permanently, although this might change the language of the OS completely to Polish, I'm not sure. Nov 29, 2018 at 18:12
  • i.imgur.com/cCAiQxr.png - I have no idea what I'm doing with this system
    – Ja Yeti
    Nov 29, 2018 at 18:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .