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

Visual Basic Dates

The date fields being saved by a VB program were being saved
as #2003-11-22#. For reasons unknown to me these dates began
to be saved as "11/22/2003"
All of these dates were made dates with the "DateValue"
instruction and when used as input to Excel both formats
sort as dates but not intermingled. All "11/22/2003"
formated dates sort in date order but before the #2003/11/22#.
What would cause the format of these dates to change and what
can I change to make these date save in the #2003/11/22# format?
I really need help with this problem!
Riley Brice
rb*****@charter.net
Jul 17 '05 #1
8 5317
rb*****@charter.net (Riley) wrote in message news:<92**************************@posting.google. com>...
The date fields being saved by a VB program were being saved
as #2003-11-22#. For reasons unknown to me these dates began
to be saved as "11/22/2003"
All of these dates were made dates with the "DateValue"
instruction and when used as input to Excel both formats
sort as dates but not intermingled. All "11/22/2003"
formated dates sort in date order but before the #2003/11/22#.
What would cause the format of these dates to change and what
can I change to make these date save in the #2003/11/22# format?


Saved where? How are you writing the values out? How are you viewing
these dates?

DateValue returns a VB Date variable which uses an internal format to
hold the information. It can then be displayed any way you want to
and different ways of viewing the information use different defaults.
You need to post sample code showing what you are doing with the
values and provide more context.
Jul 17 '05 #2
Me
Riley wrote:
The date fields being saved by a VB program were being saved
as #2003-11-22#. For reasons unknown to me these dates began
to be saved as "11/22/2003"
All of these dates were made dates with the "DateValue"
instruction and when used as input to Excel both formats
sort as dates but not intermingled. All "11/22/2003"
formated dates sort in date order but before the #2003/11/22#.
What would cause the format of these dates to change and what
can I change to make these date save in the #2003/11/22# format?
I really need help with this problem!
Riley Brice
rb*****@charter.net


No idea why it changed, but using the Format command will force it to
output whatever way you need it.
For example:

<code>

Function find_date() As String

find_date = Format(Now, "ddd, d mmm yyyy hh:mm:ss")

End Function

</code>

Will produce this output:

Sat, 27 Dec 2003 11:27:50
Re

Jul 17 '05 #3
Me
Me wrote:

This does what you need:

<code>

Function find_date() As String

find_date = Format(Now, "yyyy/mm/dd")

End Function

</code>

Output today is:

2003/12/27

Jul 17 '05 #4
Possibly your windows global settings? USA format is mm/dd/yyyy but UK
format for instance is DD/MM/YYYY. Having your global settings wrong
would cause Excel to display standard date format different than you are
used to.

Riley wrote:
The date fields being saved by a VB program were being saved
as #2003-11-22#. For reasons unknown to me these dates began
to be saved as "11/22/2003"
All of these dates were made dates with the "DateValue"
instruction and when used as input to Excel both formats
sort as dates but not intermingled. All "11/22/2003"
formated dates sort in date order but before the #2003/11/22#.
What would cause the format of these dates to change and what
can I change to make these date save in the #2003/11/22# format?
I really need help with this problem!
Riley Brice
rb*****@charter.net


Jul 17 '05 #5

"Riley" <rb*****@charter.net> wrote in message
news:92**************************@posting.google.c om...
The date fields being saved by a VB program were being saved
as #2003-11-22#. For reasons unknown to me these dates began
to be saved as "11/22/2003"
All of these dates were made dates with the "DateValue"
instruction and when used as input to Excel both formats
sort as dates but not intermingled. All "11/22/2003"
formated dates sort in date order but before the #2003/11/22#.
What would cause the format of these dates to change and what
can I change to make these date save in the #2003/11/22# format?
I really need help with this problem!
Riley Brice
rb*****@charter.net


It is possible that a software install may have modified your Regional
Setting (check Control Panel). But as suggested by "Me", you can always use
the format command, e.g. Format(yourdate,"yy/m/d"))
Jul 17 '05 #6
> But as suggested by "Me"...

Is that Me as in **you** or is that Me as in Me (not **me**, but Me)?<g>

Rick
Jul 17 '05 #7
Thanks to all who responded to my problem. You provided the answer that I needed.
Thanks,
Riley
Jul 17 '05 #8

"Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote in message
news:ub********************@comcast.com...
But as suggested by "Me"...


Is that Me as in **you** or is that Me as in Me (not **me**, but Me)?<g>

Rick


LOL .. I was confused myself after I posted that message.
Jul 17 '05 #9

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

Similar topics

0
by: Ray | last post by:
Date problem. Using non American date formats with Microsoft Access and Visual Basic. I set my regional settings to English(Ireland) or English(United Kingdom) and my date appears in Access as...
3
by: pix | last post by:
Hello, I would like to start learning Visual Basic, and I was wondering if there are any recomendations to any ebooks, or actual books for that matter. I have my eye on this book by John Smiley,...
2
by: AK | last post by:
I don't want any part of the previous discussion on Visual Basic versus Visual Basic.Net. My query is about using Visual Basic for Applications; and whether it is better to use Visual Basic 6 or...
2
by: frossberg | last post by:
Hello! I tried to install the Visual Basic.NET Resource Kit (http://msdn.microsoft.com/vbasic/vbrkit/) but obviously something went very wrong and now it sems impossible both to repair and to...
21
by: Philipp | last post by:
Hey, did anyone have a good paper about the opject orianteted concept? wishes
4
by: sqlguy | last post by:
Why do we have to contact MS for a problem that has been with this compiler from at least the beta of VS 20005. I am so sick and tired of the 30 - 40 clicks it takes to dismiss VS when there is a...
97
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in...
2
by: swb76 | last post by:
I have a query in MSAccess and it is a select query. As i understand, any query run from Visual Basic would be returned in a recordset. Can i display the results to the user in a datasheet view?...
0
by: keithsimpson3973 | last post by:
Does anyone know if it is possible to display the value of a date picker control on a vb6 form that the user selected on an access report? I am using vb6 to display a report selection and it has a...
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: 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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.