By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,550 Members | 918 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,550 IT Pros & Developers. It's quick & easy.

Retrieve the year from database

P: 5
Hi, how do I select only the year from the date in database when the date is store as MMyyyy?
Apr 19 '13 #1

✓ answered by vijay6

Hey Esll, retrieve date from database then you can use Substring method to extract year like as follows.

Expand|Select|Wrap|Line Numbers
  1. string date = "042013";
  2. MessageBox.Show(date.Substring(2));

Share this Question
Share on Google+
2 Replies


100+
P: 158
Hey Esll, retrieve date from database then you can use Substring method to extract year like as follows.

Expand|Select|Wrap|Line Numbers
  1. string date = "042013";
  2. MessageBox.Show(date.Substring(2));
Apr 19 '13 #2

P: 5
It works. Thanks for your help!
Apr 23 '13 #3

Post your reply

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