我有一个可通过java.util.Calendar处理日期的android应用
当我想使用今天的日期时,我使用:
Date today = Calendar.getInstance().getTime();
我想知道如何处理昨天的日期,我尝试了多种语法,但是没有用,我在考虑类似
昨天=今天-24(UNITS.HOURS)
但这是不正确的!
答案 0 :(得分:2)
尝试一下:
使用此代码,您将始终获得昨天的日期。
# addprocs here before @everywhere definitions
addprocs(2)
@everywhere function count_proteins(fpath::String)
cnt::Int = 0
if !isfile(fpath)
write(Base.stderr, "FASTA not found!")
else
reader = open(FASTA.Reader, fpath)
for record in reader
cnt += 1
end
end
# return the count
cnt
end
"""Count sequences in parallel."""
function parallel_count_proteins(fPaths::Array{String, 1})
fut = Dict{Int, Future}()
# launch the jobs
for (i, fastaPath) in enumerate(fPaths)
r = @spawn count_proteins(fastaPath)
fut[i] = r
end
for (i, res) in fut
s = fetch(res)
end
end
### MAIN ###
flist = ["f1", "f2", "f3", "f4"]
parallel_count_proteins(flist)
答案 1 :(得分:0)
您可以尝试这样:
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, (cal.get(Calendar.DAY_OF_MONTH) - 1));
Date yesterDayDate = cal.getTime();