在计算一个人的年龄时,微距似乎没有考虑在内。
Sub alcohol_test()
Dim strBirthday As Date
strBirthday = CDate(InputBox("Input date of birth to be verified: ", "Date of Birth"))
If DateDiff("yyyy", strBirthday, Date) < 21 Then MsgBox ("Customer underage, sale of alcohol illegal.") _
Else MsgBox ("Age Confirmed: Alcohol may be sold")
End Sub
答案 0 :(得分:0)
更糟的是:
比较下一年的12月31日和1月1日,
Microsoft说,export default class App extends Component {
componentDidMount() {
//global.catData="testting";
return fetch('http://******?action=category')
.then((response) => response.json())
.then((responseJson) => {
this.dataSource = responseJson
global.dState=1;
const self=this;
global.check="hello";
const first = responseJson[0];
var rdata=[];
for (var i = 0; i < responseJson.length; i++) {
rdata.push(responseJson[i].name);
}
this.setState({
isLoading: false,
ddata :rdata
})
})
}
constructor(props) {
super(props);
this.state = {
isLoading: true,
ddata:[]
}
}
render() {
//this.findCoordinates();
//Alert.alert(this.state.location);
if (this.state.isLoading) {
return (
<View style={{flex: 1, paddingTop: 150}}>
</View>
);
}
//alert(global.check);
//alert("loaded");
var temp ="";
const DD=[];
var something = this.state.ddata;
//alert(this.state.isLoading);
//alert(global.check);
//alert(global.check);
for(var d=0;d<3;d++){
let dd=d;
let temp = something[dd]
DD.push({
screen: HomeScreen,
navigationOptions: ({ navigation }) => ({
title: temp
})
});
}
DD.unshift({
screen: SettingsScreen,
navigationOptions: ({ navigation }) => ({
drawerLabel: () => null
})
});
const MyApp = DrawerNavigator(
DD,
{
initialRouteName: "1",
drawerPosition: 'left',
contentComponent: CustomDrawerContentComponent,
drawerOpenRoute: 'DrawerOpen',
drawerCloseRoute: 'DrawerClose',
drawerToggleRoute: 'DrawerToggle'
});
return (
<MyApp />
)
}
}
`````
的Year(“ yyyy”)返回1,即使只有一天的时间。
因此,最好将两个日期进行比较。 G。如果生日是21年前的一天。
DateDiff
我更改了变量名,因为使用日期值时,以“ str”开头的内容会产生误导。