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

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips > Additional Libraries
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Additional Libraries Users contributed libraries.
This sub-forum is only available to licensed users.

DateConvert library

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-28-2010, 08:08 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default DateConvert library

The attached library is converting dates from Gregorian or Julian calendars to Hebrew calendar, and vice versa.

It operates on dates from 100 AD.

It operates on desktop and Device.

Requires .NET 2.0

Includes a MoonPhase method, as I found that this functionality of the Hebrew calendar is useful with GPS programs (more than the dates...).

I hope it will be useful to someone. I plan to use it in my Family tree program and in the double calendar program.

Edit: updated to ver 1.1, includes two methods for finding if a year is a Leap year.
Edit: version 1.2 to "immune" against different system regional formats of Date and Time.
Edit: updated to ver 1.3 which can accept dd/mm/yyy or mm/dd/yyyy formats, no matter which regional setting you have.
Edit: ver 1.4 now its done automatically, no need to declare it in New1.
Attached Files
File Type: zip DateConvert1.4.zip (18.3 KB, 60 views)
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 02-01-2010 at 12:44 PM.
Reply With Quote
  #2 (permalink)  
Old 01-28-2010, 01:07 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Ver 1.1 , addition of two methods.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #3 (permalink)  
Old 01-28-2010, 05:13 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

I have a frustrating problem with this library.
When I run an application that use it on my laptop - by the IDE or after compilation, everything works fine.

When I run the same application on my Desktop - it fails whenever it uses the library.

both computers run windows XP.
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 01-28-2010 at 05:26 PM.
Reply With Quote
  #4 (permalink)  
Old 01-28-2010, 05:42 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

You are implicitly using the local computer regional settings (with DateTime.Parse(date) and maybe other methods as well)
Maybe one computer has different settings than the other.
Reply With Quote
  #5 (permalink)  
Old 01-28-2010, 05:44 PM
Basic4ppc Veteran
 
Join Date: Jan 2009
Location: Bayern, Germany
Posts: 489
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hello derez

code is still hard to understand, for me. But, I Love your MoonPhase method.

William
Reply With Quote
  #6 (permalink)  
Old 01-28-2010, 06:40 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Erel
I am trying to change the format of the date but it does not help.

Can you please check if it runs for you ?

William

I think the code is simple. What isn't clear to you ? I'll be glad to explain.
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #7 (permalink)  
Old 01-28-2010, 06:46 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,689
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

It is failing here because currently my computer default date format is mm/dd/yy and not dd/mm/yy.
Reply With Quote
  #8 (permalink)  
Old 01-28-2010, 07:04 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Erel
I found this in the .net:

public static DateTimeFormatInfo InvariantInfo { get;}
belongs to system.Globalization

But I don't have a clue what to do with it.
It is supposed to make the dateTime formats invariant to the culture.

I found this http://primates.ximian.com/~lupus/co...ormatInfo.html file of the Globalization namespace.
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 01-28-2010 at 07:21 PM.
Reply With Quote
  #9 (permalink)  
Old 01-28-2010, 07:33 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Erel
I changed in my computer the regional settings to Hebrew, so the short date format (which was like yours) changed to dd/mm/yyyy and immediately the program runs like a speedboat.

Now can you help me define the library to become invariant to the format ??

Of course I can change the library to the other format but than it will cause problems to other computers.

Thanks.
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 01-28-2010 at 07:36 PM.
Reply With Quote
  #10 (permalink)  
Old 01-28-2010, 07:49 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default



I added this line:
IFormatProvider culture = new System.Globalization.CultureInfo("fr-FR", true);

and now it does not matter if I use English us (mm/dd/yyyy) or united kingdom (dd/mm/yyyy) or hebrew (dd/mm/yyyy) - it works.

I am updating the library.
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 01-28-2010 at 08:01 PM.
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
Door library (Beta) - Special library Erel Official Updates 60 01-13-2011 11:23 AM
Merging Outlook library and Phone library Erel Official Updates 11 09-15-2010 09:22 AM
PhoneticAlgorithms Library (ex-StringComparison Library) moster67 Additional Libraries 10 11-11-2008 07:46 PM


All times are GMT. The time now is 07:07 AM.


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