Cabinetman Posted August 9, 2009 Posted August 9, 2009 (edited) I need to take a date field that is not always today's date (example: 8/1/2009) and change the output to yyyy-mm-dd I'm trying to use a calc field as text since I get a "?" if I use it as date: Let ( [y = Right ( date ; 4 ) ;m = Left ( date ; 2 ) ;d = Middle ( date ; 4 ; 2 )] ; Substitute ( y & "-" & m & "-" & d ; "/" ; "-" )) However since the date field isn't 08/01/2009 I can't get a consistent output. I looked at some custom functions but can't quite find what I need ... I think I'm close but maybe I'm going about this wrong? Help is appreciated. Edited August 9, 2009 by Guest
comment Posted August 9, 2009 Posted August 9, 2009 Use the date functions - Year(), Month () and Day() - to extract individual date elements, instead of text functions like Left() and Middle().
Lee Smith Posted August 9, 2009 Posted August 9, 2009 You also do not need the Substitute function, Try Let ( [y = Year ( Date ) ; m = Right ( 0 & Month ( Date ); 2) ; d = Right ( 0 & Day ( Date ) ; 2)] ; y & "-" & m & "-" & d ) HTH Lee
Cabinetman Posted August 9, 2009 Author Posted August 9, 2009 (edited) I'm getting a "?" with your calc..... Edit: Spoke to soon. When I changed the calc output to text instead of date it's now ok... thanks Edited August 9, 2009 by Guest
Recommended Posts
This topic is 5644 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now