# 現在時刻(Now, CurrentDateTime)

# Bash

date

# C++

gettimeofday() を使う

#include <time.h>
#include <sys/time.h>

double gettimeofday_sec()
{
    struct timeval tv;
    gettimeofday(&tv, NULL);
    return tv.tv_sec + (double)tv.tv_usec*1e-6;
}

# C#

DateTime.Now

# Java

long a = System.currentTimeMillis();

# PHP

$dt = new DateTime(); // DateTime class

# PowerShell

$dt = [DateTime]::Now

単に Get-Date で良いかも

# Python

t = datetime.datetime.now()  # datetime class

# Ruby

t = Time.now  # Time class
t = Time.new  # now でも new でも

[ 📩 ご意見 ]