我有一個文件(termino.txt)這是所有填寫的格式如下:比較字符串 - Lua的
- 埋單
- 2015-08-30T13:22:53.108Z
- 去看醫生
- 2015-09-30T13:22:53.108Z
- ....
所有偶數行是的形成RFC 3339時間戳。我需要的是將今天的日期與這些日期的文件進行比較,看看它們是否相同。我試試這個:
local function verifica(evt)
local nome= ''
local dia = ''
local turn = 1
local data = os.date("%x")
local file = io.open("termino.txt", "r")
while true do
nome = dia
line = file:read()
dia = line
if (turn %2 == 0) then
> Here I need to compare "data" with "dia" that will receive string with RFC 3339 timestamp format.
end
turn ++
end
end
我需要幫助做出這個比較!由於
'本地數據= os.date( 「%F」)',比較前10個字符'如果數據==行:子(1,10)then' –
我在巴西。所以我想當我運行本地數據= os.date(「%F」)時,格式將是「DD/MM/YYYY」,但在文件中格式爲「YYYY-MM-DD」!我如何解決它? –
使用'os.date'%Y-%m-%d「' –