Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate chrono;
- use chrono::{Timelike, Utc};
- fn main() {
- println!("{}, {name}", time_of_the_day_greetings(), name="John");
- }
- fn time_of_the_day_greetings() -> &'static str{
- let now = Utc::now();
- let hour = now.hour();
- if hour < 12 {
- "Good morning"
- } else if hour < 18 {
- "Good afternoon"
- } else {
- "Good evening"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement