翻译我的正确出生年月日为1999.11.12
时间: 2023-06-26 09:10:31 浏览: 62
The correct translation of "我的正确出生年月日" to English is "My correct date of birth", and the translation of "1999.11.12" to Chinese is "1999年11月12日". Therefore, the correct translation of "我的正确出生年月日为1999.11.12" is "My correct date of birth is November 12th, 1999."
相关问题
返回当前日期的格式为年月日时分秒.
好的,以下是返回当前日期的格式为年月日时分秒的Python代码:
```python
import time
current_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
print("当前时间为:", current_time)
```
输出结果类似于:
```
当前时间为: 2022-08-18 09:45:30
```
只取年月日的java.util.Date对象将时分秒清零
可以使用 `java.util.Calendar` 类的 `set` 方法来将时分秒清零,然后再将 `Calendar` 对象转换为 `Date` 对象。
以下是示例代码:
```java
import java.util.Calendar;
import java.util.Date;
public class Main {
public static void main(String[] args) {
Date date = new Date(); // 获取当前时间
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 0); // 将时设为0
calendar.set(Calendar.MINUTE, 0); // 将分设为0
calendar.set(Calendar.SECOND, 0); // 将秒设为0
calendar.set(Calendar.MILLISECOND, 0); // 将毫秒设为0
Date newDate = calendar.getTime(); // 将 Calendar 对象转换为 Date 对象
System.out.println(newDate);
}
}
```
输出结果为:
```
Thu Jul 01 00:00:00 CST 2021
```