My Journey

Inspiration

I was inspired by the simplicity and flexibility of Flask, which allows for the rapid development of web applications. I wanted to create a simple application that could serve as a foundation for future projects.

What I Learned

Throughout the development, I learned about the core concepts of Flask, such as routes and view functions. I also learned about the Unix epoch time and how it's used as a universal standard for representing time in computing systems.

How I Built app.py

I started by importing the necessary modules and creating a Flask application instance:

from flask import Flask
import time

app = Flask(__name__)

Then, I created a simple function hello() that returns a greeting message:

def hello():
    """
    This function returns a greeting message.
    """
    return "Hi, Guys!"

Next, I created a function seconds_since_epoch() that returns the number of seconds since the Unix epoch:

def seconds_since_epoch():
    """
    Returns the number of seconds since the Unix epoch.
    """
    epoch = time.time()
    return str(epoch)

Finally, I created a function days_since_epoch() that calculates the number of days since the Unix epoch:

def days_since_epoch():
    """
    Calculate the number of days since the epoch.

    Returns:
        str: The number of days since the epoch.
    """
    epoch = time.time()
    days = epoch / 86400

Challenges

One of the challenges I faced was understanding the concept of Unix epoch time. However, after some research, I was able to grasp the concept and implement it in my functions.

Built With

Share this project:

Updates