labpack/records/time.py
def humanFriendly(self, time_zone='', include_day=True, include_time=True):

        ''' a method to report a human friendly string from a labDT object

        :param time_zone: [optional] string with timezone to report in
        :return: string with date and time info
        '''

    # validate inputs
        zeroHourPattern = re.compile('\s0\d:')
        title = 'Timezone input for labDT.humanFriendly'
        human_format = ''
        if include_day:
            human_format += '%A, '
        human_format += '%B %d, %Y'
        if include_time:
            human_format += ' %I:%M%p %Z'
        get_tz = get_localzone()
        if time_zone:
            # if time_zone.lower() in ('utc', 'uct', 'universal', 'zulu'):
            #     raise ValueError('time_zone cannot be UTC. %s requires a local timezone value. Try:\nfor tz in pytz.all_timezones:\n  print tz' % title)
            try:
                get_tz = tz.gettz(time_zone)
            except:
                raise ValueError('%s is not a valid timezone format. Try:\nfor tz in pytz.all_timezones:\n  print tz' % title)
        
    # construct human friendly string from labDT
        dtLocal = self.astimezone(get_tz)
        dtString = format(dtLocal, human_format)
        zeroHour = zeroHourPattern.findall(dtString)
        if zeroHour:
            noZero = zeroHour[0].replace(' 0',' ')
            dtString = zeroHourPattern.sub(noZero,dtString)
        return dtString
 a method to report a human friendly string from a labDT object

        :param time_zone: [optional] string with timezone to report in
        :return: string with date and time info
        
a method to report a human friendly string from a labDT object
a method to report a human friendly string from a labDT object
def humanFriendly(self, time_zone='', include_day=True, include_time=True):
        zeroHourPattern = re.compile('\s0\d:')
        title = 'Timezone input for labDT.humanFriendly'
        human_format = ''
        if include_day:
            human_format += '%A, '
        human_format += '%B %d, %Y'
        if include_time:
            human_format += ' %I:%M%p %Z'
        get_tz = get_localzone()
        if time_zone:
            try:
                get_tz = tz.gettz(time_zone)
            except:
                raise ValueError('%s is not a valid timezone format. Try:\nfor tz in pytz.all_timezones:\n  print tz' % title)
        dtLocal = self.astimezone(get_tz)
        dtString = format(dtLocal, human_format)
        zeroHour = zeroHourPattern.findall(dtString)
        if zeroHour:
            noZero = zeroHour[0].replace(' 0',' ')
            dtString = zeroHourPattern.sub(noZero,dtString)
        return dtString
def humanFriendly ( self , time_zone = '' , include_day = True , include_time = True ) : zeroHourPattern = re . compile ( '\s0\d:' ) title = 'Timezone input for labDT.humanFriendly' human_format = '' if include_day : human_format += '%A, ' human_format += '%B %d, %Y' if include_time : human_format += ' %I:%M%p %Z' get_tz = get_localzone ( ) if time_zone : try : get_tz = tz . gettz ( time_zone ) except : raise ValueError ( '%s is not a valid timezone format. Try:\nfor tz in pytz.all_timezones:\n  print tz' % title ) dtLocal = self . astimezone ( get_tz ) dtString = format ( dtLocal , human_format ) zeroHour = zeroHourPattern . findall ( dtString ) if zeroHour : noZero = zeroHour [ 0 ] . replace ( ' 0' , ' ' ) dtString = zeroHourPattern . sub ( noZero , dtString ) return dtString
a method to report a human friendly string from a labDT object
a method to report a human friendly string from a labDT object
''' a method to report a human friendly string from a labDT object

        :param time_zone: [optional] string with timezone to report in
        :return: string with date and time info
        ''' # validate inputs
 # if time_zone.lower() in ('utc', 'uct', 'universal', 'zulu'):
 #     raise ValueError('time_zone cannot be UTC. %s requires a local timezone value. Try:\nfor tz in pytz.all_timezones:\n  print tz' % title)
 # construct human friendly string from labDT

string with date and time info
string with date and time info
self
time_zone
[optional] string with timezone to report in
[ optional ] string with timezone to report in
include_day
include_time