473,761 Members | 7,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert date to ticks?

Hi,

Does anybody know how to convert date to ticks from a dateTimePicker?
What I'm using now isn't working.

I'm trying to use a dateTimePicker to set an appointment in Outlook
with a reminder. I need this reminder to remind the recipient 14 days
in advance.

I'm having problems with the ReminderMinutes BeforeStart. If I simply
multiply the minutes by the days, the reminder doesn't have the
checkbox checked or it is checked, but with 0 minutes. As if it can't
figure out that many minutes.

I've written some code to do this for me, but with the same results
(checkbox in the reminder set to 0 minutes).

Private Sub btnSave_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnSave.Click
Dim oApp As Outlook.Applica tion = New Outlook.Applica tion
Dim lDays As Long
Dim lMinutes As Long

lMinutes = DaysToMinutes(l Days)

' Create a new AppointmentItem .
Dim oAppt As Outlook.Appoint mentItem =
oApp.CreateItem (Outlook.OlItem Type.olAppointm entItem)

oAppt.Subject = "Parking Permits Will expire in two weeks"
oAppt.Body = "Let Employees with Parking Permits know the
expiration date is two weeks away"
oAppt.Location = "Watsonvill e"
oAppt.Start = Convert.ToDateT ime(dtpExpired. Value)
oAppt.End = Convert.ToDateT ime(dtpExpired. Value)
oAppt.ReminderS et = True
oAppt.ReminderM inutesBeforeSta rt = lMinutes

' Save to Calendar.
oAppt.Save()

' Clean up.
oApp = Nothing
oAppt = Nothing

End Sub

Function DaysToMinutes(B yVal days As Long) As Long
Return days =20160
End Function

End Class

Does anybody know if the TimeStamp would work better for subtracting
days? If so, how do I convert the date to ticks?

Here is a TimeSpan string that could be used to show negative values:
"[-]14:00:00:00", but this is using ticks...

Thanks,

Nov 20 '05 #1
3 5962
sparkle wrote:
Return days =20160


I don't know it this is your problem or just a typo in the post, but that
should obviously not be an equals sign. It would return zero as you
described, since 'days=20160' equals false.

--
Sven Groot

http://unforgiven.bloghorn.com

Nov 20 '05 #2
Hi Sparkle,

Why are you sending such a large piece of code that has nothing to do with
this.

Does anybody know how to convert date to ticks from a dateTimePicker?


Simple questions are eays to answer however when the rest of the text seems
to have no relation with the question you mostly get no answer. Here is a
direct answer on your question where I added 14 days in advance)

Dim InTicksDatePlus Fourteen As Long = _
CDate(DateTimeP icker1.Text).Ad dDays(14).Ticks

I hope this helps?

Cor
Nov 20 '05 #3
* hr****@hra.co.s anta-cruz.ca-dot-us.no-spam.invalid (sparkle) scripsit:
Does anybody know how to convert date to ticks from a dateTimePicker?
What I'm using now isn't working.


'Me.DateTimePic ker1.Value.Tick s'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

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

Similar topics

1
3628
by: Num | last post by:
Hi all, I have to convert a J2EE date as a long ("Millis") in a .NET date as a long ("Ticks") In Java, currentTimeMillis, is the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. In .NET, DateTime.Ticks is the 100-nanosecond intervals that have
1
1787
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance would be identical. I was 100% incorrect. The code below produces the results: CType Took: 0.2187528 seconds. Convert Took: 12.187656 seconds.
4
5677
by: David | last post by:
We only know the system ticks count, but we have no date or time function. So we need the source code about solving the problem. I have googled several times and no good results. can u help me? Thanks in advance.
2
2873
by: Remi Caron | last post by:
Hi, I took over an Visual Object project (Visual Clipper) in that language there is a function to: Convert a string containing a 32-bit binary date to a date data type. That function is called bin2Date and there also is a Date2bin function of course in cannot find how to do this in csharp. The string looks like this "!$%\0" and should return 03/09/52 can somebody point me in the right direction? Have tried Convert class in several ways...
15
9075
by: JenHu | last post by:
Hi expert, I have a data field (birthdate) contains a datetime datatype (mm/dd/yyyy), how can I convert to mmdd?? say, the birthday is 8/1/1979 and convert to mmdd DOB = DS.Tables("AcctInfoTble").Rows(3)("BRTHDATE") strResult.Insert(12, DOB.PadLeft(37, " ")) ---------------------------------------------------------------------------------------------------
29
9128
by: james | last post by:
I have a problem that at first glance seems not that hard to figure out. But, so far, the answer has escaped me. I have an old database file that has the date(s) stored in it as number of days. An example is: 36,525 represents 01/01/1900. The starting point date is considered to be : 00/00/0000. I have looked thru Help and used Google and have not really found an answer. I know that Leap Years need to be accounted for too. Any...
17
71456
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#
1
6883
by: raghu1 | last post by:
How to convert a given date to its equvalent ticks.: string d="5/15/2006 12:10:44 PM"; // string 2 date ... dt=Convert.ToDateTime(d); // Date 2 ticks ... dt2ticks=dt.Ticks; string ticks = Convert.ToString(dt2ticks);
3
1960
by: Gugale at Lincoln | last post by:
Hi, I am working on an application which uses date as a primary key. All my records are at least a few millisecond apart and are in the form "20070630T12:50:24.207". SQL Server has a precision of 1/3000 of second to store dates. I would like to bring down the precision of my data to match SQL Server's precision. I am doing this to avoid conflicts in ADO.Net dataset. ADO.Net is more precise and accepts duplicate rows when it shouldn't...
0
9522
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9948
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7327
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.