The output of Checkhed.Date is 2018, I just want 18.
I am trying update an E9 calc field.
ltrim(convert(varchar, datepart(year, CheckHed.CheckDate)), ‘20’) is giving me an error. If I remove the , ‘20’ it returns 2018
The output of Checkhed.Date is 2018, I just want 18.
I am trying update an E9 calc field.
ltrim(convert(varchar, datepart(year, CheckHed.CheckDate)), ‘20’) is giving me an error. If I remove the , ‘20’ it returns 2018
Drop the ltrim and try yy instead of year
Or it might be YY, I forget.
ltrim is just for leading spaces.
convert(varchar, datepart(yy, CheckHed.CheckDate)) still gives me 2018
Sorry, drop the convert also.
Just
Let me back up now since I am having issues.
Individually I broke down 09/22/2018; MM , DD, YY for syntax testing.
Here is the convert code from E9 to E10
convert(varchar, datepart(month, CheckHed.CheckDate)) + ‘/’ + convert(varchar, datepart(day, CheckHed.CheckDate)) + ‘/’ + left-TRIM(convert(varchar, datepart(year, CheckHed.CheckDate)),‘20’)
The bold is what I am trying to fix. The above in E9 change 9/22/2018 into 9/22/18
Hopefully someone can shed some light on this. Left-Trim should change to ltrim, but then I cant use the ‘20’ anymore.
so I need to convert my Checkdate (YYYY) to a string to add it to MM/DD/YY.
Try this.
substring(convert(varchar,datepart(year,CheckHed.CheckDate)),3,2)
There’s probably a better way to do it, but I think it works.
Ltrim is just of trimming white space.
LEFT is the command you want.
Correction, I think it’s RIGHT.
Thanks! Also saving the link reference.
convert(varchar, datepart(month, CheckHed.CheckDate)) + ‘/’ + convert(varchar, datepart(day, CheckHed.CheckDate)) + ‘/’ + substring(convert(varchar,datepart(year,CheckHed.CheckDate)),3,2)
You can also just use Format(field,‘dd/mm/yy’)
Or something close to that. You don’t need to break up the field if you don’t want to.
Thanks.
Format(CheckHed.Checkdate, ‘MM/dd/yy’) I tried mm but it gave me a 00 value I need to talk to the bank to see if 09 is acceptable or do I need the 9 only. Thanks. Much less complicated.
mm is minutes.
What if you try M/d/yy?
Yes, try “M”. There are all sorts of settings for the date formatting that I cannot remember them all.