The latest time to apply for an e-visa is in 48 hours prior to your trip. But, it is best to avoid this as the process may take time. It is ideal to begin your visa application in advance.