我有一个文件(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“' –