It is currently March 29th, 2024, 1:54 am

Timestamp Help

Get help with creating, editing & fixing problems with skins
bora12
Posts: 13
Joined: August 9th, 2016, 4:24 pm

Re: Timestamp Help

Post by bora12 »

jsmorley wrote: January 9th, 2019, 9:54 pm 1) If there is no Format option on a Time measure, the string value will be the result of the default %HH:%MM:%SS and the numeric value will be the Windows timestamp.

3) If you use a Time measure in a section variable as [MeasureName:] it will return the number value. That MIGHT be a timestamp, or it might be a number that has nothing to do with the timestamp, or most likely, it will be ZERO.

4) If you use a Time measure in a section variable as [MeasureName:Timestamp] it will return the timestamp value. It will ALWAYS return the timestamp value, no matter what any Format option is set to.
These 3 rules cleared up A LOT of issues that I was having, thank you for taking the time to clarify. :thumbup:
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Timestamp Help

Post by xenium »

Is it possible to display the names of the previous 6 months and the next 6 months using the TimeStamp option?

Thank you
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Timestamp Help

Post by balala »

xenium wrote: April 29th, 2019, 4:37 pm Is it possible to display the names of the previous 6 months and the next 6 months using the TimeStamp option?
I'd do it recursively, through a lua script. If you're interested, save the following code as MyLua.lua into the @Resources folder:

Code: Select all

function PrevMonthLength(month, year)
	if (month == 1) or (month == 2) or (month == 4) or (month == 6) or (month == 8) or (month == 9) or (month == 11) then
		return 31
	elseif (month == 5) or (month == 7) or (month == 10) or (month == 12) then
		return 30
	elseif (year % 4 == 0) and (year % 400 ~= 0) then
		return 29
	else
		return 28
	end
end

function MonthLength(month, year)
	if (month == 1) or (month == 3) or (month == 5) or (month == 7) or (month == 8) or (month == 10) or (month == 12) then
		return 31
	elseif (month == 4) or (month == 6) or (month == 9) or (month == 11) then
		return 30
	elseif (year % 4 == 0) and (year % 400 ~= 0) then
		return 29
	else
		return 28
	end
end

function Month1(month,year)
	return os.date('%B', (os.time(t)+24*3600*MonthLength(month, year)))
end

function MonthNum1(month,year)
	return os.date('%m', (os.time(t)+24*3600*MonthLength(month, year)))
end

function Year1(month,year)
	return os.date('%Y', (os.time(t)+24*3600*MonthLength(month, year)))
end

function Month2(month,year)
	return os.date('%B', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year)))))
end

function MonthNum2(month,year)
	return os.date('%m', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year)))))
end

function Year2(month,year)
	return os.date('%Y', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year)))))
end

function Month3(month,year)
	return os.date('%B', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year)))))
end

function MonthNum3(month,year)
	return os.date('%m', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year)))))
end

function Year3(month,year)
	return os.date('%Y', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year)))))
end

function Month4(month,year)
	return os.date('%B', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year))+MonthLength(MonthNum3(month,year), Year3(month,year)))))
end

function MonthNum4(month,year)
	return os.date('%m', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year))+MonthLength(MonthNum3(month,year), Year3(month,year)))))
end

function Year4(month,year)
	return os.date('%Y', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year))+MonthLength(MonthNum3(month,year), Year3(month,year)))))
end

function Month5(month,year)
	return os.date('%B', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year))+MonthLength(MonthNum3(month,year), Year3(month,year))+MonthLength(MonthNum4(month,year), Year4(month,year)))))
end

function MonthNum5(month,year)
	return os.date('%m', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year))+MonthLength(MonthNum3(month,year), Year3(month,year))+MonthLength(MonthNum4(month,year), Year4(month,year)))))
end

function Year5(month,year)
	return os.date('%Y', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year))+MonthLength(MonthNum3(month,year), Year3(month,year))+MonthLength(MonthNum4(month,year), Year4(month,year)))))
end

function Month6(month,year)
	return os.date('%B', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year))+MonthLength(MonthNum3(month,year), Year3(month,year))+MonthLength(MonthNum4(month,year), Year4(month,year))+MonthLength(MonthNum5(month,year), Year5(month,year)))))
end

function MonthNum6(month,year)
	return os.date('%m', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year))+MonthLength(MonthNum3(month,year), Year3(month,year))+MonthLength(MonthNum4(month,year), Year4(month,year))+MonthLength(MonthNum5(month,year), Year5(month,year)))))
end

function Year6(month,year)
	return os.date('%Y', (os.time(t)+24*3600*(MonthLength(month, year)+MonthLength(MonthNum1(month,year), Year1(month,year))+MonthLength(MonthNum2(month,year), Year2(month,year))+MonthLength(MonthNum3(month,year), Year3(month,year))+MonthLength(MonthNum4(month,year), Year4(month,year))+MonthLength(MonthNum5(month,year), Year5(month,year)))))
end

function MonthP1(month,year)
	return os.date('%B', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)-os.date('%d', os.time(t)))))
end

function MonthNumP1(month,year)
	return os.date('%m', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)-os.date('%d', os.time(t)))))
end

function YearP1(month,year)
	return os.date('%Y', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)-os.date('%d', os.time(t)))))
end

function MonthP2(month,year)
	return os.date('%B', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(MonthNumP1(month,year),YearP1(month,year))-os.date('%d', os.time(t)))))
end

function MonthNumP2(month,year)
	return os.date('%m', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(MonthNumP1(month,year),YearP1(month,year))-os.date('%d', os.time(t)))))
end

function YearP2(month,year)
	return os.date('%Y', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(MonthNumP1(month,year),YearP1(month,year))-os.date('%d', os.time(t)))))
end

function MonthP3(month,year)
	return os.date('%B', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))-os.date('%d', os.time(t)))))
end

function MonthNumP3(month,year)
	return os.date('%m', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))-os.date('%d', os.time(t)))))
end

function YearP3(month,year)
	return os.date('%Y', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))-os.date('%d', os.time(t)))))
end

function MonthP4(month,year)
	return os.date('%B', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))+PrevMonthLength(tonumber(MonthNumP3(month,year)),tonumber(YearP3(month,year)))-os.date('%d', os.time(t)))))
end

function MonthNumP4(month,year)
	return os.date('%m', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))+PrevMonthLength(tonumber(MonthNumP3(month,year)),tonumber(YearP3(month,year)))-os.date('%d', os.time(t)))))
end

function YearP4(month,year)
	return os.date('%Y', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))+PrevMonthLength(tonumber(MonthNumP3(month,year)),tonumber(YearP3(month,year)))-os.date('%d', os.time(t)))))
end

function MonthP5(month,year)
	return os.date('%B', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))+PrevMonthLength(tonumber(MonthNumP3(month,year)),tonumber(YearP3(month,year)))+PrevMonthLength(tonumber(MonthNumP4(month,year)),tonumber(YearP4(month,year)))-os.date('%d', os.time(t)))))
end

function MonthNumP5(month,year)
	return os.date('%m', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))+PrevMonthLength(tonumber(MonthNumP3(month,year)),tonumber(YearP3(month,year)))+PrevMonthLength(tonumber(MonthNumP4(month,year)),tonumber(YearP4(month,year)))-os.date('%d', os.time(t)))))
end

function YearP5(month,year)
	return os.date('%Y', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))+PrevMonthLength(tonumber(MonthNumP3(month,year)),tonumber(YearP3(month,year)))+PrevMonthLength(tonumber(MonthNumP4(month,year)),tonumber(YearP4(month,year)))-os.date('%d', os.time(t)))))
end

function MonthP6(month,year)
	return os.date('%B', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))+PrevMonthLength(tonumber(MonthNumP3(month,year)),tonumber(YearP3(month,year)))+PrevMonthLength(tonumber(MonthNumP4(month,year)),tonumber(YearP4(month,year)))+PrevMonthLength(tonumber(MonthNumP5(month,year)),tonumber(YearP5(month,year)))-os.date('%d', os.time(t)))))
end

function MonthNumP6(month,year)
	return os.date('%m', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))+PrevMonthLength(tonumber(MonthNumP3(month,year)),tonumber(YearP3(month,year)))+PrevMonthLength(tonumber(MonthNumP4(month,year)),tonumber(YearP4(month,year)))+PrevMonthLength(tonumber(MonthNumP5(month,year)),tonumber(YearP5(month,year)))-os.date('%d', os.time(t)))))
end

function YearP6(month,year)
	return os.date('%Y', (os.time(t)-24*3600*(2*PrevMonthLength(month, year)+PrevMonthLength(tonumber(MonthNumP1(month,year)),tonumber(YearP1(month,year)))+PrevMonthLength(tonumber(MonthNumP2(month,year)),tonumber(YearP2(month,year)))+PrevMonthLength(tonumber(MonthNumP3(month,year)),tonumber(YearP3(month,year)))+PrevMonthLength(tonumber(MonthNumP4(month,year)),tonumber(YearP4(month,year)))+PrevMonthLength(tonumber(MonthNumP5(month,year)),tonumber(YearP5(month,year)))-os.date('%d', os.time(t)))))
end
The code of the skin uses Inline Lua functions:

Code: Select all

[Rainmeter]
Update=1000

[Variables]


[MeasureMonth]
Measure=Time
Format=%m
Disabled=1

[MeasureYear]
Measure=Time
Format=%Y
Disabled=1

[MeasureLuaScript]
Measure=Script
ScriptFile=#@#MyLua.lua

[MeterMonths]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Next months: [&MeasureLuaScript:Month1([&MeasureMonth],[&MeasureYear])] / [&MeasureLuaScript:Month2([&MeasureMonth],[&MeasureYear])] / [&MeasureLuaScript:Month3([&MeasureMonth],[&MeasureYear])] / [&MeasureLuaScript:Month4([&MeasureMonth],[&MeasureYear])] / [&MeasureLuaScript:Month5([&MeasureMonth],[&MeasureYear])] / [&MeasureLuaScript:Month6([&MeasureMonth],[&MeasureYear])]#CRLF#Previous months: [&MeasureLuaScript:MonthP1([&MeasureMonth],[&MeasureYear])] / [&MeasureLuaScript:MonthP2([&MeasureMonth],[&MeasureYear])] / [&MeasureLuaScript:MonthP3([&MeasureMonth],[&MeasureYear])] / [&MeasureLuaScript:MonthP4([&MeasureMonth],[&MeasureYear])] / [&MeasureLuaScript:MonthP5([&MeasureMonth],[&MeasureYear])] / [&MeasureLuaScript:MonthP6([&MeasureMonth],[&MeasureYear])]
InlineSetting=Color | 255,0,0
InlinePattern=(.* months:) .*
DynamicVariables=1
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Timestamp Help

Post by jsmorley »

I'm not sure I understand what is being asked for here. This feels like something that on the surface sounds really simple, but might be more complicated in the context of more extensive requirements.

In and of itself, I don't see why this needs to be more than a simple lookup table.

So some Lua like this:

Code: Select all

function Initialize()

	monthNames = {
		'january',
		'february',
		'march',
		'april',
		'may',
		'june',
		'july',
		'august',
		'september',
		'october',
		'november',
		'december'
	}

end

function MonthFromCurrent(offsetArg)
	
	currentDate = os.date('*t')
	currentMonth = currentDate.month
	offsetMonth = currentMonth + offsetArg
	if offsetMonth < 1 then offsetMonth = offsetMonth + 12 end
	if offsetMonth > 12 then offsetMonth = offsetMonth - 12 end
	
	return monthNames[offsetMonth]
	
end
Which you then use with Inline Lua like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Lua]
Measure=Script
ScriptFile=#CURRENTPATH#Test.lua
Disabled=1

[MeterCurrent]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=Current Month: [Lua:MonthFromCurrent(0)]

[MeterLess1]
Meter=String
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=Month Less 1: [Lua:MonthFromCurrent(-1)]

[MeterPlus1]
Meter=String
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=Month Plus 1: [Lua:MonthFromCurrent(1)]

[MeterLess6]
Meter=String
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=Month Less 6: [Lua:MonthFromCurrent(-6)]

[MeterPlus6]
Meter=String
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=Month Plus 6: [Lua:MonthFromCurrent(6)]

1.png


Six less than the current month and six from the current month will of course be the same thing. There are 12 months in a year.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Timestamp Help

Post by jsmorley »

Or like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Lua]
Measure=Script
ScriptFile=#CURRENTPATH#Test.lua
Disabled=1

[MeterLess6]
Meter=String
W=80
X=40
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(-6)]

[MeterLess5]
Meter=String
W=80
X=([MeterLess6:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(-5)]

[MeterLess4]
Meter=String
W=80
X=([MeterLess5:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(-4)]

[MeterLess3]
Meter=String
W=80
X=([MeterLess4:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(-3)]

[MeterLess2]
Meter=String
W=80
X=([MeterLess3:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(-2)]

[MeterLess1]
Meter=String
W=80
X=([MeterLess2:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(-1)]

[MeterCurrent]
Meter=String
W=80
X=([MeterLess1:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=0,255,0,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(0)]

[MeterPlus1]
Meter=String
W=80
X=([MeterCurrent:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(1)]

[MeterPlus2]
Meter=String
W=80
X=([MeterPlus1:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(2)]

[MeterPlus3]
Meter=String
W=80
X=([MeterPlus2:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(3)]

[MeterPlus4]
Meter=String
W=80
X=([MeterPlus3:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(4)]

[MeterPlus5]
Meter=String
W=80
X=([MeterPlus4:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(5)]

[MeterPlus6]
Meter=String
W=80
X=([MeterPlus5:XW]+40)
StringAlign=Center
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=0,5,0,5
AntiAlias=1
StringCase=Proper
DynamicVariables=1
Text=[Lua:MonthFromCurrent(6)]

2.png
You do not have the required permissions to view the files attached to this post.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Timestamp Help

Post by xenium »

Thank you very much for help ! :bow:
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Timestamp Help

Post by jsmorley »

xenium wrote: April 30th, 2019, 6:27 am Thank you very much for help ! :bow:

Glad to help. Keep in mind that you can't do direct math with any date increment larger than a week. All dates are based on seconds, and while there are a defined and consistent number of seconds in a minute/hour/day/week, there are not in month/year or anything else larger. You can't add or subtract "a month" from a date, as there is no valid numeric value for a month. So while we can ask "what is the name of the previous month?" just fine, we can't ask "what date was it one month ago?". On the 31st day of any month, that has no answer. You can't trick it by asking "what date was it four weeks ago?", as while that will have an answer, it's not the same question as "what date was it one month ago?". In any given year, there will be 4 months that have 5 weeks in them.