Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a column Date in DB which is a combination of date,month,year like 21/6/2012.
Now I want to extract the date and month from that column (21/6)and should get that in a single column Date1.How can i get it ?
Posted
Updated 20-Jun-12 23:01pm
v2

Access handles dates according to the date time format of your system unlike SQL SERVER which uses it like yyyy-mm-dd

To do what you need use the following query

SQL
SELECT Str(Datepart("d",datecolumn))+'/'+Str(Datepart("m",datecolumn)) AS Expr1
FROM tablename
WHERE (((tablename.[id])=4));


Modify where condition according to your needs

Best of luck.........
 
Share this answer
 
use this query it will work i have checked it on access.

SQL
SELECT str(datepart("d",Start_date)) +'/'+ str(datepart("m",Start_date))
FROM tblwork


and you can use this query also

SQL
SELECT mid( format(Start_date,'dd/MM/yyyy'),1,5)
FROM tblwork
WHERE len(Start_date)>0;
 
Share this answer
 
Comments
sandeep nagabhairava 21-Jun-12 6:55am    
thank you prosan...:)
my 5!
Dear sandeep,

I had made this query in SQL Server 2005, please run this query in Access DB and see the result.. I think following query will work. replace
SQL
getdate()
with your date field.


SQL
select rtrim(convert(char,month(getdate())))+ '/' + rtrim(convert(char,day(getdate())))



Thanks
Ashish
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900