Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

date string..put it according to month, day and year

Posted on 2008-06-11
9
Medium Priority
?
211 Views
Last Modified: 2013-11-27
I have three field

Date                   Month               day            year
1-30-2008
12-11-2006
1-15-2007

my other fields have no records. Just the Date field has records. How would I divide the date so it updates the corresponding fields accordingly
something like this

Date                   Month               day            year
1-30-2008             1                     30            2008
12-11-2006          12                    11            2006
1-15-2007             1                     15            2007

Thanks

0
Comment
Question by:syedasimmeesaq
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 3

Expert Comment

by:NIMTUG_Simon
ID: 21764856
Select [Date], Month([Date]) as [Month], Day(]Date]) as [Day], Year([Date]) as [Year] from Table

You can add these as calculated fields in your table.
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 21764873
but how do I update the table? the above query will give me just the view and would not update the records

Thanks
0
 
LVL 3

Expert Comment

by:NIMTUG_Simon
ID: 21764875
Sry was thinking SQL Server

Might still work if not use

DatePart

Usage: DatePart(interval, date)

Interval may be set to:
yyyy for year
q for quarter
m for month
y for day of year
d for day
w for weekday
ww for week
h for hour
n for minute
s for second

Returns: Interval part of date.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 21764905
whats that? I have no idea how to use the above suggestion
Thanks
0
 
LVL 3

Accepted Solution

by:
NIMTUG_Simon earned 2000 total points
ID: 21764916
ONly got Access 2003.. not sure if later version support calculated fields

You could populate all your dates and then run the following query which will update the other columns

UPDATE Table1 SET Table1.[Day] = Day([Date]), Table1.[Month] = Month([Date]), Table1.[Year] = Year([Date]);
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 21764947
shouldn't it be

update table set month = month(date), day = day(date), year = year(date);

????????????????
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 21764951
ok no worries posted before looking at your second comment. Basically the same thing...I will try it now.
Thanks
0
 
LVL 3

Expert Comment

by:NIMTUG_Simon
ID: 21764961
It doesn't matter about the order and the Table1 prefix is optional. You should alway use [ ] around column names that are the same as in-built Access functions.
0
 
LVL 9

Author Closing Comment

by:syedasimmeesaq
ID: 31466394
thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question