473,394 Members | 1,944 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,394 software developers and data experts.

Convert "Jan" to "01"

Hi,

I am trying to convert a month data field column from "Jan" to "01". Or for february: "Feb" to "02". So the month displays in "mm" format.

Can someone help me code this in VB?

Thanks
Nov 14 '07 #1
4 2564
YarrOfDoom
1,247 Expert 1GB
This can easily be done with select case I think...
Just get your value, set up the whole "select case"-thing and store the become value.
eg:
Expand|Select|Wrap|Line Numbers
  1. select case inputvariable
  2. case "Jan"
  3. inputvariable = "01"
  4. case "Feb"
  5. inputvariable = "02"
  6. ...
  7. case "Dec"
  8. inputvariable = "12"
  9. end select
Yarr
Nov 14 '07 #2
This can easily be done with select case I think...
Just get your value, set up the whole "select case"-thing and store the become value.
eg:
Expand|Select|Wrap|Line Numbers
  1. select case inputvariable
  2. case "Jan"
  3. inputvariable = "01"
  4. case "Feb"
  5. inputvariable = "02"
  6. ...
  7. case "Dec"
  8. inputvariable = "12"
  9. end select
Yarr
Thank you for your help!

Just to build on that question. Is there a way to display "01" from a field that displays a full date: 1/1/2007.

For example, if the date displayed was 7/4/2007, I want to covert it to "07".

Thanks!
Nov 14 '07 #3
jaz215
55
if your getting it directly from the database what you can do is convert to a string then break down the date then just select case 1 = 01 then place in in the another string and display it..

hope this helps :P
Nov 15 '07 #4
QVeen72
1,445 Expert 1GB
Thank you for your help!

Just to build on that question. Is there a way to display "01" from a field that displays a full date: 1/1/2007.

For example, if the date displayed was 7/4/2007, I want to covert it to "07".

Thanks!
Hi,
use "Format" Function.
Check these:

Expand|Select|Wrap|Line Numbers
  1. Text1.Text = Format("7/4/2007","dd-mm-yyyy")
  2. Text2.Text = Format("7/4/2007","dd-mmm-yyyy")
  3. Text3.Text = Format("7/4/2007","dd-mm-yyyy dddd")
  4. Text4.Text = Format("7/4/2007","dd-mm-yyyy ddd")
  5.  
Regards
Veena
Nov 15 '07 #5

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

Similar topics

2
by: bissatch | last post by:
Hi, I am trying to use the following function: echo date("M", $i) to echo the date that the value of a variable, $i, represents (eg. 1 = Jan, 5 = May, 11 = Nov). Unfortunetely, it...
7
by: Don | last post by:
Via JavaScript within the client page containing the checkbox, I'm trying to capture the value of a checkbox to make a cookie out of it. But, all I get is the defined "ON" value, even when it is...
23
by: Phil Powell | last post by:
// OBTAINED FROM http://www.javascripter.net/faq/settinga.htm // NOTE THAT IF YOU SET days TO -1 THE COOKIE WILL BE SET TO YESTERDAY AND THUS EXPIRE function setCookie(name, value, days, docObj)...
1
by: Brian Kendig | last post by:
How do I take an index of a literal array, instead of a variable? That is, say I want to get the short name of a month. Can I do something like: $monthname = ("Jan", "Feb", "Mar", "Apr",...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.