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

Simple date format question from a new guy

I want to put the date in Year, Month, Day format so todays date,
7/8/2006, will give me 20060708.

The following code code leaves out the zeros for day and month and
gives me 200678

Dim RptDate As String
Dim wkDate As Date
wkDate = Today
RptDate = wkDate.Year & wkDate.Month & wkDate.Day

What is the easiest way to get the format I want?

Jul 9 '06 #1
2 1517
I found the answer:

RptDate = Format(Today, "yyyyMMdd")

I wish they were consistent with making month lower case like year and
day

tom c wrote:
I want to put the date in Year, Month, Day format so todays date,
7/8/2006, will give me 20060708.

The following code code leaves out the zeros for day and month and
gives me 200678

Dim RptDate As String
Dim wkDate As Date
wkDate = Today
RptDate = wkDate.Year & wkDate.Month & wkDate.Day

What is the easiest way to get the format I want?
Jul 9 '06 #2
Lower case m's are minutes, so there's a trade off there...

+++ Rick ---

--
Rick Strahl
West Wind Technologies
http://www.west-wind.com/weblog
http://www.west-wind.com/wwThreads/
"tom c" <to******@gmail.comwrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
>I found the answer:

RptDate = Format(Today, "yyyyMMdd")

I wish they were consistent with making month lower case like year and
day

tom c wrote:
>I want to put the date in Year, Month, Day format so todays date,
7/8/2006, will give me 20060708.

The following code code leaves out the zeros for day and month and
gives me 200678

Dim RptDate As String
Dim wkDate As Date
wkDate = Today
RptDate = wkDate.Year & wkDate.Month & wkDate.Day

What is the easiest way to get the format I want?
Jul 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Luiz Horacio | last post by:
Hi, I got some ASP pages and they work perfectly except for one detail: dates that are loaded on page are in dd/mm/yyyy format and I need them to load in mm/dd/yyyy format. The code line that...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
6
by: KevinD | last post by:
assumption: I am new to C and old to COBOL I have been reading a lot (self teaching) but something is not sinking in with respect to reading a simple file - one record at a time. Using C, I am...
18
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
4
by: Phillip Vong | last post by:
VS2005 in VB.NET I have 2 simple textboxes (Textbox1, Textbox2) and they both have dates. Textbox1=12/31/2006 Textbox2=12/15/2006 I need to convert these two textboxes that are in String...
2
by: Dragan | last post by:
Hi, We're working in VS 2005, Team edition, if it makes any difference at all (should be up-to-date and all that, but could not guarantee it is 100%). We've implemented a simple generic wrapper...
30
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
4
by: OzNet | last post by:
I have some functions to calculate the working days in a given period. This includes a table that is queried to calculate the number of public holidays that don’t occur on a weekend. If I test...
11
ollyb303
by: ollyb303 | last post by:
Hello, I am using a dynamic crosstab report to track performance statistics for my company and I have hit a problem. I would like the option to track stats daily (for the last 7 complete...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.