Hi Python community,

In a main script, I pass the year (yr), month (mo), day (dy) and hour(hr) into 
the utc_to_local function (pasted below) which converts that date and time into 
local standard time.  I am passing several dates and times into this function 
and would like to work with the "returned" loc_y/m/d/h values, but no output is 
visibly seen when I run the main script.  I want the "return" command to just 
return the values to me in the main script so I can work with them!  Any help 
is appreciated.  

Thanks in advance,
Neil

_________
Mac OS X 10.6.4
Python 2.6
_________

from datetime import datetime 
from pytz import timezone
import pytz

def utc_to_local(yr,mo,dy,hr):
    fmt = '%Y-%m-%d %H %Z'
    utc = pytz.utc
    local = pytz.timezone("US/Pacific")
    utc_dt = datetime(yr,mo,dy,hr, tzinfo=utc)
    loc_dt = utc_dt.astimezone(local) # local date YY-MM-DD HR TZ  
    #print utc_dt.strftime(fmt), " = ", loc_dt.strftime(fmt)

    loc_y = loc_dt.year # local year
    loc_m = loc_dt.month # local month
    loc_d = loc_dt.day # local day
    loc_h = loc_dt.hour # local hour 

    return loc_y, loc_m, loc_d, loc_h

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to