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

date format into a string

I'm trying to get '20030904' into a string where mdate is a date variable.
Using formatdatetime I can't seem to get closer than a shortdate, but that
yields '9/4/03', from which I could surely pull out strings using instr, but
is there a more direct way?

Tx for any help.

Bernie Yaeger
Nov 20 '05 #1
3 1856
"Bernie Yaeger" <be*****@cherwellinc.com> schrieb
I'm trying to get '20030904' into a string where mdate is a date
variable. Using formatdatetime I can't seem to get closer than a
shortdate, but that yields '9/4/03', from which I could surely pull
out strings using instr, but is there a more direct way?

dim s as string
s = mdate.tostring("yyyyMMdd")
--
Armin

Nov 20 '05 #2
* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
I'm trying to get '20030904' into a string where mdate is a date variable.
Using formatdatetime I can't seem to get closer than a shortdate, but that
yields '9/4/03', from which I could surely pull out strings using instr, but
is there a more direct way?


Have a look at 'Date.ToString(<format>)'.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
Tx Armin, Herfried.

Bernie
"Armin Zingler" <az*******@freenet.de> wrote in message
news:eA*************@TK2MSFTNGP12.phx.gbl...
"Bernie Yaeger" <be*****@cherwellinc.com> schrieb
I'm trying to get '20030904' into a string where mdate is a date
variable. Using formatdatetime I can't seem to get closer than a
shortdate, but that yields '9/4/03', from which I could surely pull
out strings using instr, but is there a more direct way?

dim s as string
s = mdate.tostring("yyyyMMdd")
--
Armin

Nov 20 '05 #4

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

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...
2
by: Hector A | last post by:
Hi I'm trying to convert a string that already looks like a date to a date that I can use when I pass it from java to the database. I receive the date in format yyyy-mm-dd and I need it to be a...
6
by: CLarkou | last post by:
I have a field with dates in an Access database. The format of date is short date "19/06/2004". In my regional settings I have as date format "dd/mm/yyyy". When I create a query from design to...
6
by: Willie wjb | last post by:
Hi, i have a client program that sends a filter expression to the server PC. On that server PC this filter is put over a datatable and the result is send back. the server can be located on a...
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...
20
by: andreas | last post by:
When I copy a vb.net project using date formats from one PC with a windows date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I get errors. How can I change for a while in the...
6
by: NH | last post by:
I want to allow users to enter dates in a text box in either the US "MM dd yy" format or the UK "dd MM yy" format. But how can I validate these dates? All the date functions e.g. ISdate,...
21
by: Darin | last post by:
I have an applicatoin that works 100% perfect when running on a machine setup for English (United States), but when I change it to Spanish (Mexico), the dates start giving me fits. THe reason is...
7
by: creative1 | last post by:
Hello everyone. I am experiencing a strange problem that I can't fix on my own. I think I need expert's suggestions for this. The problem is: I want to print account statement (or any other...
5
Stang02GT
by: Stang02GT | last post by:
I have been asked to validate a date on our web-page so that people cannot enter dates like 14/1/08 or 2/30/06. I have found code that will do exactly what i need it to do, but i am not sure how to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.