How to return the year (1 Viewer)

nancy54

Registered User.
Local time
Today, 10:20
Joined
Jun 19, 2018
Messages
49
I have a table with a TimeStamp field (the system Date()), and another field for the system autonumber ID. Using Right functions on both fields I have created a calculated field to return a year prefix and the last 3 digits of the ID. The problem is, instead of getting 18 (for the year), I am getting AM or PM. I have set the format to Short time, but still returns AM or PM.

Thanks in advance!
Nancy
 

nancy54

Registered User.
Local time
Today, 10:20
Joined
Jun 19, 2018
Messages
49
Thanks 26,
This did not work within the Right function...so I had to create another field (I called SystemYear) using Year(Date()) and concatenated that field with the ID field to get the an ID with a date prefix.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 10:20
Joined
Feb 19, 2002
Messages
42,970
Dates are not strings. Using string functions to operate on them can result in unexpected results.

I'm not sure why you only want the two rightmost digits but if that is what you want then you can use
Right(Year(yourdate), 2)

OR you can use the Format() function
Format(yourdate, "yy")
 

Users who are viewing this thread

Top Bottom