It is currently March 28th, 2024, 5:28 pm

TimeStamp With Milliseconds & TimeZone

General topics related to Rainmeter.
Post Reply
xavier
Posts: 6
Joined: August 5th, 2020, 7:28 pm

TimeStamp With Milliseconds & TimeZone

Post by xavier »

Hi,

Via a WebParser Measure I get a TimeStamp like this:

2020-08-05T15:33:33.014-0400

which I want to format so that I can discard the milliseconds BUT not the TimeZone.

So far:

TimeStampFormat=%Y-%m-%dT%H:%M:%S.

But I do not know how to "discard" the milliseconds and "get" the Timezone.

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

Re: TimeStamp With Milliseconds & TimeZone

Post by balala »

xavier wrote: August 5th, 2020, 7:46 pm But I do not know how to "discard" the milliseconds and "get" the Timezone.
Add a RegExpSubstitute=1 option to the WebParser measure returning the above time stamp, along with the following Substitute option: Substitute="(.*)T(.*)\.(.*)([-|\+].*)":"\1T\2\4".
xavier
Posts: 6
Joined: August 5th, 2020, 7:28 pm

Re: TimeStamp With Milliseconds & TimeZone

Post by xavier »

balala,

Fantastic!

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

Re: TimeStamp With Milliseconds & TimeZone

Post by balala »

Glad to help.
Properly using regular expressions is not simple, but can help in many cases.
Post Reply