コード例 #1
0
def convtime(s):
    return strptime(s, '%Y/%m/%dZ%H:%M').torel(time_units).value
コード例 #2
0
ファイル: courses_time.py プロジェクト: acoat/vacumm
rtime2 = ctime.torel('days since 2000')
ctime2 = rtime.tocomp().add(1, cdtime.Year)
# - compare
print rtime2 == rtime
print ctime2 <= ctime

# => Practice: Create a cdtime array and print the most recent date.

# ---- Check types
from vacumm.misc.atime import is_comptime, is_reltime, is_cdtime
print is_comptime(ctime), is_reltime(rtime), is_cdtime(ctime)

# ---- VACUMM Bonus ----
# Read from a string and a format
# => Practice: check strptime in google
mytime = strptime('1950-01-01 07:00:00',
                  '%Y-%m-%d %H:%M:%S')  # => Practice: Try different formats
# - Check
print mytime.year, mytime.minute

# We choose the french language
import locale
locale.setlocale(locale.LC_ALL, 'fr_FR')

# Write in a different format
print strftime('%e %B %Y a %Hh%M',
               mytime)  # => Practice: Try different formats

# ---- Time axes ----
print 10 * '-' + ' Time axes ' + 10 * '-'
units = 'hours since 2000-01-15 06:00'
taxis = create_time(N.arange(6.) * 48, units)
コード例 #3
0
from vacumm.misc.atime import strftime,strptime

# Lecture a partir d'une chaine de caracteres et d'un format
# (tappez strptime dans google)
mytime = strptime('1950-01-01 07:00:00','%Y-%m-%d %H:%M:%S')
# Verification partielle
print mytime.year,mytime.minute
# -> 1950 0

# On choisit la langue francaise 
import locale
locale.setlocale(locale.LC_ALL,'fr_FR')

# Ecriture sous un autre format
print strftime('%e %B %Y a %Hh%M',mytime)
# ->  1 janvier 1950 a 07h00
コード例 #4
0
from vacumm.misc.atime import strftime, strptime

# Lecture a partir d'une chaine de caracteres et d'un format
# (tappez strptime dans google)
mytime = strptime('1950-01-01 07:00:00', '%Y-%m-%d %H:%M:%S')
# Verification partielle
print mytime.year, mytime.minute
# -> 1950 0

# On choisit la langue francaise
import locale
locale.setlocale(locale.LC_ALL, 'fr_FR')

# Ecriture sous un autre format
print strftime('%e %B %Y a %Hh%M', mytime)
# ->  1 janvier 1950 a 07h00
コード例 #5
0
ファイル: courses_time.py プロジェクト: jfleroux/vacumm
# - compare
print rtime2 == rtime
print ctime2 <= ctime


# => Practice: Create a cdtime array and print the most recent date.

# ---- Check types
from vacumm.misc.atime import is_comptime,is_reltime,is_cdtime
print is_comptime(ctime),is_reltime(rtime),is_cdtime(ctime)


# ---- VACUMM Bonus ----
# Read from a string and a format
# => Practice: check strptime in google
mytime = strptime('1950-01-01 07:00:00','%Y-%m-%d %H:%M:%S') # => Practice: Try different formats
# - Check
print mytime.year,mytime.minute

# We choose the french language 
import locale
locale.setlocale(locale.LC_ALL,'fr_FR')

# Write in a different format
print strftime('%e %B %Y a %Hh%M',mytime) # => Practice: Try different formats

# ---- Time axes ---- 
print 10*'-'+' Time axes '+10*'-'
units = 'hours since 2000-01-15 06:00'
taxis = create_time(N.arange(6.)*48, units)
print taxis.getValue()