Contents [hide]
Output
Current time like this
Mon Dec 9 07:08:08 JST 2019
Code examples
JavaScript
1 2 3 | const execSync = require( 'child_process' ).execSync; let result = execSync( 'date' ).toString(); console.log(result); |
PHP
1 2 3 | <?php exec ( 'date' , $rtn ); print ( $rtn [0]. "\n" ); |
Perl
1 2 | my $result = `date`; print ( $result . "\n" ); |
Python
1 2 3 | import subprocess result = subprocess.check_output([ "date" ], shell = True ).decode( "UTF-8" ) print (result) |
Ruby
1 2 | result = `date` print(result) |
Shell
1 2 3 | #!/bin/sh RESULT=` date `; echo $RESULT; |

Author: Hajime Kurita, CEO/CTO of 1st Class, inc. Search Engineer & Web master
Certificate: AWS SOL Architect, Professional Scrum Master I, Class I IT Engineer(JP national certificate), TOEIC900+, Graduate of Tokyo university
Please follow My English twitter account for updates
IT Relatd service: VPS Ranking