How do I convert a date into a serial number?
(I'm trying to enter a FROM date and a TO date, then make my PROGRESS BAR
show how close I am to the TO date.) get it?
I know that MS Excel converts Dates into serial numbers, but I can't figure
out how to do it with VB.Net.
Please help, thanks. 4 15329
Daniel,
You could use VB's DateDiff function to find the number of time intervals
between the 2 dates. The interval can be days, hours, etc.
You could then use the time intervals to drive the progress bar.
Kerry Moorman
"Daniel Kaseman" wrote: How do I convert a date into a serial number?
(I'm trying to enter a FROM date and a TO date, then make my PROGRESS BAR show how close I am to the TO date.) get it?
I know that MS Excel converts Dates into serial numbers, but I can't figure out how to do it with VB.Net.
Please help, thanks.
Daniel,
dim myDateAsLong as long = now.ticks
I hope this helps,
Cor
This is what I done:
1) Start a new Windows application
2) Add a timer, a progressbar & a button to the form
3) Declarations:
Dim dtFrom As Date = #2/3/2005# ' Just a date I picked randomly
Dim dtTo As Date = DateTime.Now
Dim intDays As Integer
4) Double-click the button & add the following code:
intDays = Microsoft.VisualBasic.DateDiff(DateInterval.Day, dtFrom, dtTo)
'MessageBox.Show(intDays)
With ProgressBar1
.Minimum = 1
.Maximum = intDays
End With
Timer1.Enabled = True
Timer1.Interval = 200
5) Double-click the timer & add the following code:
If ProgressBar1.Value < intDays Then
ProgressBar1.Value += 1
Else
ProgressBar1.Value = intDays
Timer1.Enabled = False
End If
6) Run the project.
There are 76 days between the two dates at the time of posting
I hope this helped
Crouchie1998
BA (HONS) MCP MCSE
Combining TimeSpan Class with Cor's Ticks is a convienent way to convert to
Days, hours, min, sec, etc.
"Cor Ligthert" wrote: Daniel,
dim myDateAsLong as long = now.ticks
I hope this helps,
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lauren Quantrell |
last post by:
I have a stored procedure using Convert where the exact same Convert
string works in the SELECT portion of the procedure but fails in the
WHERE portion.
The entire SP is listed below....
|
by: Klaus Bonadt |
last post by:
In order to protect software from being copied without licence, I would like
to use something like a key, which fits only to the current system. The
serial number of the CPU or the current...
|
by: goochey |
last post by:
I'm trying to convert a Julian Date (Format "4365") into an actual calendar
date in Visual Basic, can anyone help me out with this.
|
by: Mark |
last post by:
Hi
I have been trying to convert the week number to a range of dates that
I can use. It should be fairly simple for you guru's out there but for
us mere mortals it is beyond our grasp.
I know...
|
by: Stewart Allen |
last post by:
Hi there
I'm trying to find part serial numbers between 2 numbers. The user selects a
part number from a combo box and then enters a range of serial numbers into
2 text boxes and the resulting...
|
by: jerry.ranch |
last post by:
I have a need to convert simple dates (i.e. 02/14/2005) to a number,
do some math, and convert back to a date. (in a simple query).
The math involves adding or substracting days, and days of the...
|
by: Trekmp |
last post by:
I currently work in ASP and am in the process of moving some
application across to PHP. At present I store dates in a database in
numerical format 38694, which is 08/12/2005. In ASP its very easy...
|
by: Peter |
last post by:
What is the easiest way to convert serialdate (like excel has) into real
date in VB.NET?
Thank You
Peter
|
by: Terry Jolly |
last post by:
New to C# ---- How do I convert a Date to int?
In VB6:
Dim lDate as long
lDate = CLng(Date)
In C#
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
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...
|
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: 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...
|
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: 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...
|
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,...
| |