Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Calendar Control

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-29-2007, 04:30 PM
alfcen's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu Islands
Posts: 810
Send a message via Skype™ to alfcen
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, 04:44 PM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

You just need to use Date(Calender1.Value)

Regards,
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #3 (permalink)  
Old 06-29-2007, 04:49 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
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 - 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!
Reply With Quote
  #4 (permalink)  
Old 06-29-2007, 05:20 PM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
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
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #5 (permalink)  
Old 06-29-2007, 05:58 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
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 - 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!
Reply With Quote
  #6 (permalink)  
Old 06-30-2007, 01:21 AM
alfcen's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu Islands
Posts: 810
Send a message via Skype™ to alfcen
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, 06:46 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,734
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

A simple solution is:
dt = Calendar1.Value - (Calendar1.Value mod cTicksPerDay)
Reply With Quote
  #8 (permalink)  
Old 06-30-2007, 07:45 AM
alfcen's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu Islands
Posts: 810
Send a message via Skype™ to alfcen
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Amazingly elegant!
Thanks you Erel!
Reply With Quote
  #9 (permalink)  
Old 02-11-2008, 10:21 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
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 - 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!

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

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

DEVICE: Motorola ATRIX (Dual Core) Android 2.2.1
DESKTOP: Intel Pentium Dual-core E5200; Microsoft® Windows® Vista Home (Basic); Hard Disk:320GB; Memory:4096MB
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 Off
Pingbacks are Off
Refbacks are On

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


All times are GMT. The time now is 10:24 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0