Newbies obelisk Posted January 26, 2005 Newbies Posted January 26, 2005 So this might be a really basic thing, but my brain just won't move past it, and I could not find anyhting in the forums... I am doing a .csv export of a set of records for uploading to a state access db. Everything is fine, but on one of my fields the date is formatted as xx/xx/xxxx, when I upload it it shows as xx/xx/xx or worse xx/x/xxx. I have a calculated set of fields that I run my script through to get the .csv file, and I was curious if there is a way to write a calculation that will take out the first 2 digits of a year (ex: 1/1/04 instead of 1/1/2004) Any help would be appreciated, Thank You Jesse
transpower Posted January 26, 2005 Posted January 26, 2005 Change the format of the date: Layout Mode | Format | Date | Format as dd/mm/yy
Newbies obelisk Posted January 26, 2005 Author Newbies Posted January 26, 2005 I tried changing the format of the date, but that just changes how it looks, not how it is stored.... Since I am exporting a portion of the records it grabs all the stored data, not the formatted data.. I figured it out, I had to do this in my calculation for the upload field: Month (Date Served) & "/" & Day (Date Served) & "/" & Right ( Year (Date Served); 2 ) Thanks for the quick reply though, Jesse
-Queue- Posted January 26, 2005 Posted January 26, 2005 If you want to retain leading zeroes, Right( "0" & Month(Date Served); 2 ) & "/" & Right( "0" & Day(Date Served); 2 ) & "/" & Right( Year(Date Served); 2 )
spb Posted January 26, 2005 Posted January 26, 2005 Qeue: That's a beautiful calc. I'm ashamed to say how I've handled this before: Case(Month(DateServed) < 10, "0" & Month(DateServed), Month(DateServed) ... etc.) The complicated way is always easy. The simple way can be pretty tough to see sometimes. Steve Brown
-Queue- Posted January 26, 2005 Posted January 26, 2005 I used to do worse when forcing leading zeroes. Choose( Length(field) - 1, "0000", "000", "00", "0" ) & field, for example, to force a 5-digit number. Right( "0000" & field, 5 ) is so much easier. Once you learn, you never return.
Recommended Posts
This topic is 7241 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