Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Calendar Control


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-29-2007, 05:30 PM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Awards Showcase
Beta Tester 
Total Awards: 1
Default Calendar Control

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
Reply With Quote
  #2 (permalink)  
Old 06-29-2007, 05:44 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 485
Awards Showcase
Beta Tester 
Total Awards: 1
Default

You just need to use Date(Calender1.Value)

Regards,
RandomCoder
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #3 (permalink)  
Old 06-29-2007, 05:49 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,313
Default

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

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #4 (permalink)  
Old 06-29-2007, 06:20 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 485
Awards Showcase
Beta Tester 
Total Awards: 1
Default

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
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #5 (permalink)  
Old 06-29-2007, 06:58 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,313
Default

Quote:
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

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #6 (permalink)  
Old 06-30-2007, 02:21 AM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Awards Showcase
Beta Tester 
Total Awards: 1
Default

RandomCoder, Cableguy,

Thank you both for your quick assistance.

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 :-)

Thanks a lot guys!
Robert
Reply With Quote
  #7 (permalink)  
Old 06-30-2007, 07:46 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,132
Default

A simple solution is:
dt = Calendar1.Value - (Calendar1.Value mod cTicksPerDay)
Reply With Quote
  #8 (permalink)  
Old 06-30-2007, 08:45 AM
alfcen's Avatar
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu
Posts: 424
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Amazingly elegant!
Thanks you Erel!
Reply With Quote
  #9 (permalink)  
Old 02-11-2008, 11:21 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,313
Default

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

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing

Last edited by Cableguy : 02-11-2008 at 11:30 PM.
Reply With Quote
  #10 (permalink)  
Old 02-12-2008, 03:28 AM
Senior Member
 
Join Date: May 2007
Posts: 130
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Or how Erel's do.
TodayTicks=Now-Now Mod cTicksPerDay
__________________
Rioven

Sony Ericsson XPERIA X1i WM6.1
480x800 Display Resolution
with QWERTY keyboard
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar Control: I can't see the year. sloopa Questions & Help Needed 4 06-25-2008 07:30 PM
Calendar control a simple and a complicated question Cableguy Questions & Help Needed 3 02-09-2008 06:45 PM
Creating a Calendar control dynamically? willisgt Questions & Help Needed 5 01-06-2008 10:48 AM
Close method for calendar control specci48 Basic4ppc Wishlist 0 11-04-2007 09:44 AM
Calendar control BjornF Questions & Help Needed 7 07-05-2007 08:52 AM


All times are GMT. The time now is 12:22 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0