473,405 Members | 2,185 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,405 software developers and data experts.

covert a number in to Date format YYYYMMDD

I have one number i want to convert in to a date format

the size of the value is =8 Char
20091212
i ant to conver it in to a date format
my sysyem doent understand wether its adate or not its taking as a number

Thanks
Nani
Oct 27 '09 #1
4 3047
MikeTheBike
639 Expert 512MB
@naaniibabu
Hi
assuming that it is always an 8 digit number as yyyymmdd then something like

Expand|Select|Wrap|Line Numbers
  1. Dim intDateNumber as long
  2. Dim strDateNumber as string
  3. Dim Thisdate as Date
  4.  
  5. intDateNumber = 20091212
  6. strDateNumber = CStr(intDateNumber)
  7.  
  8. ThisDate = DateSerial(left(strDate,4),Mid(strDateNumber,5,2),right(strstrDate,2))
In VBA or VB6 you don't need to convert to a string, but not sure in .NET (I assume you will need to!).


MTB
Oct 27 '09 #2
Thanks MTB

todya i tried it in my machine it is not working
pls let me know what happend

Thanks
Nani
Oct 28 '09 #3
MikeTheBike
639 Expert 512MB
@naaniibabu
Hi

I have lost my crystal ball, so maybe you could let US know what happened !!?

MTB
Oct 28 '09 #4
Hi ,

It's Working Fine thanks alot ,for your guidance

Thanks
Nani
Oct 29 '09 #5

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

Similar topics

2
by: cg_news | last post by:
In short, what I am trying to do is, based on a date, calculate the week of year (as described in ISO 8601), then calculate the first and last date in this week period and return them in the format...
1
by: OKI | last post by:
Hi. I had a VB program that was using an SQL Server 6.5 DB. Date format was dd/mm/yyyy. Now the DB was changed to an SQL Server 7 and the date format is yyyy/mm/dd. How can I do for changing...
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: Bruce Cushman | last post by:
My DB is Access 2000 based "possibly written in 2002" and I have to send and receive update files, ported to a UNIX server by FTP, DB unknown. The file content uses a fixed length string, zero...
5
by: Doug Bell | last post by:
Hi, I have some data in the format of yyyymmdd (Int32) that I want to display, in a datagrid, formatted in International Date Format dd MM yyyy. Any suggestions on an efficient approach? ...
7
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in...
6
by: SQLcat | last post by:
I have a VBScript as follows: Dim xmlHTTP : Set xmlHTTP = CreateObject("Microsoft.XMLHTTP") Dim adoStream : Set adoStream = CreateObject("adodb.stream") Const bGetAsAsync = False ' wait for...
1
by: Beckster6701 | last post by:
I have a MSAccess database that is linked to a SQL server. I cannot change the SQL server datatype as I am not the only one that uses the database. I'm trying to convert the text field to a valid...
10
by: DontellTrevell via AccessMonster.com | last post by:
HELP!!....I need to calculate the numer of days elapsed between two field. But, the date format is YYYYMMDD. How can i accomplsh this? -- Dontell Trevell Message posted via AccessMonster.com...
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?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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
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.