Hi Erel
The Calendar Control returns the Ticks value for any selected date plus today's current time. Is there any way of removing the time component and have Calendar.Value provide the Ticks for the selected date at 00:00 o'clock(without too many additional lines of code)?
Any plan to provide a Time Control separate from the Calendar control?
Thanks and Cheers
Robert
I think you just have to subtract the current time to the date selected...
somthing like
t=calendar1.value-TimeH-TimeM-TimeS
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
My Posts helped you? Consider Buying me a Porto Glass!
Did I miss something?
Date(Calender1.Value) works for me, then if you want the current time you just need to use Time(Now)
If you need the date formated differently then you can use DateFormat to set it the way you want.
Regards,
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
The Calendar Control returns the Ticks value for any selected date plus today's current time.
Since I never used the calendar control before, I simply replyed to Alfacen's question....
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
My Posts helped you? Consider Buying me a Porto Glass!
Sorry, I should have been more precise. My JulianDate calculation routine accepts date and time in units of Ticks, such as JulianDate(Now).
However, when date and time, as selected with a Calendar control for date and NumericUpDown Controls for time, are other than Now then these selections need to be converted to Ticks.
I have come to the following solution:
JulianDate(DateParse(Date(cal1.Value)) + 1/24 * (numGMHour.Value + numGMMin.Value / 60 + numGMSec.Value / 3600) * cTicksPerDay)
The JulianDate routine accounts for time zone and DST.
I've spent 2 hours experimenting last night without success but just a few minutes to the solution after reading your responses this morning.
Actually, it's my first time to employ the Calendar control, too :-)
Since Alfacen question regarded the Julian calendar, i ask the same about the normal calendar...
Parsing a date string to ticks is straight foward (dateparse), wich gives us the ticks count at t 00H00s of the date...
But how to get the now ticks of the day, so that we can compare 2 dates as ticks....
because we cannot compare two dates as strings...(12/02/2008<13/02/2008 does not compute), how can it be achieved with tick?
Edit: A possible solution?
To get the ticks of the day(today):
dateparse(date(now))
can it be this simple?and so complicated, we first have to parse the actual date(ticks) to a string to parse it again to ticks?
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)
My Posts helped you? Consider Buying me a Porto Glass!