[SOLVED] System Date Format is Returning Wrong Format

G'day,

[Sorry, I figured out my problem while double checking my work before submitting this. Thought I'd leave it for anyone else with the same problem later]

I have been trying to use a tag Value Changed script to populate another string array tag. It has been working just fine, and I can display the tag contents in a perspective table successfully. The problem is that I am using the system.date.now() and system.date.format() functions to insert a time stamp, but it always formats it wrong, and sometimes even returns the wrong date/time. Here I have temporarily added the now() return and the format string I'm using just to show what I mean. Am I crazy or is there something seriously wrong?

image

The only correct row is second to the top, but I don't want to use day of the year, I want day of the month. If I have to, I could just crop off the milliseconds from the now() function I suppose, but this should work like it's supposed to.

[I realized my problem was that the column in the table had the dateFormat set as well as the date being formatted in the data. Just remove the formating in the data or in the table]

I am using the system.date.now() and system.date.format() functions to insert a time stamp,

That doesn't sound right. You should be working with DATE datatypes throughout until it has to be read by a human at which point you format it.

Tip: we don't use the [SOLVED] notation in our question titles. Instead, post the solution and then mark your own answer as the Solution. Your post will then get the green checkmark in the index listings. As far as the forum software is concerned your question is still unsolved.

2 Likes