Effacer les filtres
Effacer les filtres

How do you write a program that gives the current time and day?

1 vue (au cours des 30 derniers jours)
Alexis Williams
Alexis Williams le 8 Fév 2021
Réponse apportée : KSSV le 8 Fév 2021
I am very new to programming, and cannot figure out how to run this program correctly. My work is shown below. Please Help!
time = clock ();
day = date ();
fprintf('The current date is %f\n', day);
fprintf('The current time is %0f\n', time);

Réponse acceptée

KSSV
KSSV le 8 Fév 2021
d = datetime('now') ;
fprintf('The current date is %s\n', d);
The current date is 08-Feb-2021 05:19:58

Plus de réponses (0)

Catégories

En savoir plus sur Dates and Time dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by