Changing t_stamp

Currently I want to change the format from year-month-day-hour-minute-second and just have hour-minute-second independent from the other information. is this possible?

Where is this t_stamp? In the database?

I want to use the current time given by the system (IGNITION) to make an expression tag where if the value of time
is for example:
time<5:00:00 then =shift 1
time<13:00:00 then =shift 2
time<21:00:00 then =shift 3

I already have the time in a tag but can’t seem to get the expression tag to work :cry: :sob:

Here you can see the tag 24H Time which I made in order to be able to use that time to calculate the 8 hour shift in the SHIFTS tag.

Try using the Date expression functions.

The one I linked is dateIsAfter which returns a boolean.

Try this expression:

floor(((dateExtract(now(1000), 'hour') + 3) % 24) / 8) + 1

Thank you :slight_smile: I’ll try this

Hi, I used this code:

if({[.]24H Time} < ‘5:00:00’, {[.]SHIFTS}=3,
if({[.]24H Time} < ‘13:00:00’, {[.]SHIFTS}=1,
if({[.]24H Time} < ‘21:00:00’, {[.]SHIFTS}=2,
if({[.]24H Time} < ‘24:00:00’, {[.]SHIFTS}=3, {[.]SHIFTS}=0

but my SHIFTS tag is currently changing between 0 and 1 when it should just stay in 1 and then change over to 2 after 13/1pm

Consider using timeBetween() to do your comparison. timeBetween() won’t work with 24 hour time, but it’s easy to use.
Also, don’t give it the option of putiing in a zero when zero isn’t supposed to be an option. :slight_smile:

Here’s an example using timeBetween()

if(timeBetween(now(),"5:00:00 am","12:59:59 pm"),1,
if(timeBetween(now(),"1:00:00 pm"," 20:59:59 pm"),2,

1 Like

Thanks :smiley: I will try this right now.

This worked!!! Thanks so much for the help :grinning: