You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the default datetime module return timetuple with hour, minute, and second but what JalaliDatetime.timetuple() returns doesn't have these three items, so sadly in my case I should make my timetuple manually, I know that it's not a big deal but I think maybe it's the best that your excellent library behaves just like datetime.
for my use, I need to have timetuple with date and time of Tehran timezone on a foreign server for logging my logs into our Persian paradigm. (if it's help!)
from khayyam import JalaliDatetime
from time import struct_time
from pytz import timezone
def tehrantime(*args, **kwargs):
tehran_dt = JalaliDatetime.now(tz=timezone('Asia/Tehran'))
time_tuple = struct_time((tehran_dt.year, tehran_dt.month, tehran_dt.day, tehran_dt.hour, tehran_dt.minute,
tehran_dt.second, tehran_dt.weekday(), tehran_dt.dayofyear(), 1))
return time_tuple
Thanks BTW.
The text was updated successfully, but these errors were encountered:
the default datetime module return timetuple with hour, minute, and second but what JalaliDatetime.timetuple() returns doesn't have these three items, so sadly in my case I should make my timetuple manually, I know that it's not a big deal but I think maybe it's the best that your excellent library behaves just like datetime.
for my use, I need to have timetuple with date and time of Tehran timezone on a foreign server for logging my logs into our Persian paradigm. (if it's help!)
Thanks BTW.
The text was updated successfully, but these errors were encountered: