Show current time: Difference between revisions
Jump to navigation
Jump to search
m (→Related pages) |
|||
| Line 18: | Line 18: | ||
OS in Mandarin Chinese (Windows 10): 2017/02/03 週五 15:35:31.61 | OS in Mandarin Chinese (Windows 10): 2017/02/03 週五 15:35:31.61 | ||
</pre> | </pre> | ||
If PHP was installed. (1) Saved the PHP execution result to the file `today.txt` (2) Read the file content and save to the variable '%TODAY%' | |||
<pre>command: | |||
php -r "echo date('Y-m-d);" > today.txt | |||
SET /P TODAY=<today.txt | |||
ECHO %TODAY% | |||
</pre> | |||
output: `{{Template:Today}}` | |||
== PHP & MySQL == | == PHP & MySQL == | ||
Revision as of 10:37, 3 December 2019
Multiple approached to show current time
Linux BASH
- date (Linux
) output the system date: 'Thu Oct 25 15:05:10 CST 2012' [1][2]
- TZ=Asia/Taipei date (Linux
) output the time from the Taipei/CST timezone [3]
Windows DOS
output: OS in English: Thu 05/03/2012 OS in Mandarin Chinese (XP): 2012/05/03 星期四 OS in Mandarin Chinese (Windows 8, Windows Server 2008 R2): 2014/07/01 週二 OS in Mandarin Chinese (Windows 10): 週一 2019/12/02
- prompt $d $t $_$P$G (Win
[4])
output: OS in Mandarin Chinese (Windows 10): 2017/02/03 週五 15:35:31.61
If PHP was installed. (1) Saved the PHP execution result to the file `today.txt` (2) Read the file content and save to the variable '%TODAY%'
command:
php -r "echo date('Y-m-d);" > today.txt
SET /P TODAY=<today.txt
ECHO %TODAY%
output: `2026-07-18`
PHP & MySQL
timestamp in PHP and MySQL syntax