Java formatar data

an anonymous user · June 16, 2021
import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        int dia = 5;
        int mes = 11;
        int ano = 2022;
        String data_dev = String.format("%02d", dia) + "/" + String.format("%02d", mes) + "/" + Integer.toString(ano);
        System.out.println(data_dev);
    }
}
Output
(Run the program to view its output)

Comments

Please sign up or log in to contribute to the discussion.