473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

setting date format.

I am useing the copyobject command in VB, and in the newname section of the code I am useing "tblStuff_"& date. To add todays date to the table name for archive purposes. How can I get the date to show up as mmddyyy format in stead of the defalt of mmdyyyy? The latter part will not allow the tables to appear in order of date, for example a table name ending in 8/1/2011 the next one ending in 8/15/2011 follow, the table with the date of 8/8/2011 follows after that, if two digits are used for the date it would keep them in order.
Aug 31 '11 #1
4 1761
TheSmileyCoder
2,322 Expert Mod 2GB
You would need to use the Format command on your date.

Try something like this:
Expand|Select|Wrap|Line Numbers
  1. "tblStuff_" & Format(date,"mmddyyyy")
and if that doesn't work, have a look at the help file on Format.
Sep 1 '11 #2
Thank you, this worked great. Here is the final [code] "tblstuff_"& format (Date-8,"mm/dd/yyyy")[code, gives me tblstuff_08/24/2011. this is the format I was looking for. The reason I subtracted 8 was to give me the date for close of businness from the week before.
Thank you again!
Bruce
Sep 1 '11 #3
TheSmileyCoder
2,322 Expert Mod 2GB
Thats good to hear. Im happy that it worked for you.

Just one note, which you can consider. I would advice against using special characters such as / + - in table or even field names. If I need a special character I usually use underscore _ .
The reasons are that its usually easier to write and maintain code that does not involve the special charecters in table/field names.

TheSmileyCoder
Sep 1 '11 #4
NeoPa
32,556 Expert Mod 16PB
Another very important point here is that it is a much (A really extreme much) better idea to archive your data into a single table than creating loads of different tables for what is fundamentally the same job. Simply add a [Date Archived] field into your table to allow recognising the data in the future.

If you must create tables with dates in that you want to be in order (and this is equally, in fact more, true for files) then I would suggest a format of yyyymmdd instead. That way they are all automatically kept in the same order as the dates.
Sep 1 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Chopper | last post by:
I realise this question has been raised many times but I am still no wiser as to why setting the locales will not work in my ASP application. I have searched on google groups etc. and tried...
1
by: David Lee AU | last post by:
We have an ASP.NET page that displays a date without a format specifier (in order to determine to default locale setting) and the date is shown as mm/dd/yyyy. We previously were able to set the...
15
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to...
0
by: James Foreman | last post by:
Looking at the documentation on EXPORT, when exporting a date column it will automatically use yyyymmdd. One could choose to use ISO format, but unfortunately the client I'm exporting to can't...
6
by: Dario Di Bella | last post by:
Hi all, we have the following urgent issue affecting our development team. Initially we had one particular workstation that failed executing queries on a DB2 database, raising an invalid date...
1
by: Rat | last post by:
Hi, Using vb.net. Using WIN32 API. i need to change the DATE Format(from MM/dd/yyyy to dd/MM/yyyy) in Reginal Settings. How will i do that. Regards,
2
by: Rahul | last post by:
Hey Guys I have a development environment, in which the whole SQL syntax is stored in the Database. So the syntax in the databse column could be "where BirthDate = '12/31/2005' and ID =...
9
by: insomniux | last post by:
Hi, I am having a problem with formatting the default value of a date field. It has been discussed earlier in many topics, but still I cannot solve the problem. What's happening: I have various...
20
by: andreas | last post by:
When I copy a vb.net project using date formats from one PC with a windows date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I get errors. How can I change for a while in the...
2
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.