“Tanggal Waktu” Kode Jawaban

Datetime Python

from datetime import datetime as d
date = d.now()
print(date.strftime("%Y-%m-%d %H:%M:%S"))
Majid Peidaei

cara mengatur format datetime di python

import datetime

x = datetime.datetime(2018, 9, 15)

print(x.strftime("%b %d %Y %H:%M:%S"))
Xenophobic Xenomorph

Tanggal Waktu

 			DateTime date = DateTime.Now.AddHours(26);
            DateTime dateNow19 = new DateTime(date.Year, date.Month, date.Day, 19, 00, 00);
            DateTime dateNow08 = new DateTime(date.Year, date.Month, date.Day, 08, 00, 00);
            Console.WriteLine(date);
            Console.WriteLine(dateNow19);
            Console.WriteLine(dateNow08);
            if (date < dateNow19 && date > dateNow08)
            {
                Console.WriteLine("Success19");
            }
            else
            {
                Console.WriteLine("False");
            }
Info Important

Tanggal Waktu

//first day and last day of month
DateTime date = ...
var firstDayOfMonth = new DateTime(date.Year, date.Month, 1);
var lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1);
Info Important

tanggal Waktu

<?php 
     $deliverytime = new DateTime('2014-09-08 06:00:00');
     $hour = $deliverytime->format('H');
     if ($hour < 12) {
       echo "Morning";
     } else {
       echo "Afternoon or evening";
     }
?>
H_B_0_1

tanggal Waktu

dateutil - powerful extensions to datetime
pip install python-dateutils
CodeBlack reactor

Jawaban yang mirip dengan “Tanggal Waktu”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya