Results 1 to 21 of 21

Thread: [RESOLVED] gregorian date convert to hebrew format vb6

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,144

    Resolved [RESOLVED] gregorian date convert to hebrew format vb6

    me and my friend are sitting here for 2 hours trying to figure out how to
    convert gregorian date to a hebrew date
    we tried several of sites tried some codes but didnt get what we wanted
    as for a couple of years in this form i know that all the best programmers are here that can help us
    with this solution.
    we tried to convert the gregorian date in the regional and language options in windows xp
    no luck
    did any body did this before?
    tried similer thing?
    any help will be very much appreciated
    regards
    salsa31

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,966

    Re: gregorian date convert to hebrew format vb6

    I'm not sure it's that simple. I know the Gregorian Date has been re-set a few times over the course of history, depending who was running what ever empire at the time. I don't think the Hebrew calendar has ever been reset. Generally speaking, there's usually some kind of conversion formula that will allow the figuring of equivalent dates in the different calendars. Some are straight forward, others not so much. there are some where the best you can hope for is to find where the two both have a matching base date, then roll it forward until you get to the desired date. I've worked with gregorian to julien dates and back, those are established calculations that are fairly easy to find, as well as between gregorian dates and a custom calendar - this had the added bonus that the conversion was basically one-for-one, making the adjustments easier.

    did you look at this: http://www.jewishgen.org/JOS/josdates.htm

    https://www.google.com/webhp?sourcei...20date&es_th=1


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    7,453

    Re: gregorian date convert to hebrew format vb6

    Never tried such a thing...(and doubt I ever will)....but others have....Here, look at this VB6/VBA example:

    http://www.dafaweek.com/hebcal/hebcalvb6.php

  4. #4
    Hyperactive Member
    Join Date
    Oct 2013
    Posts
    389

    Re: gregorian date convert to hebrew format vb6

    That, or a small 3 lines of code in .Net.
    depends how open-minded are you toward adding the microsoft's .Net Framework as a dependency

    http://stackoverflow.com/questions/6...ate-conversion

    (last post)

  5. #5

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,144

    Re: gregorian date convert to hebrew format vb6

    hey Stum You are saying i need to call this web service to get this thing working?
    and if so i need to store it in a module?
    sami i dont know PHP
    tg i saw this earlier but it is not related to vb 6

  6. #6
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    7,453

    Re: gregorian date convert to hebrew format vb6

    php?????? Did you look at the link? It is VB code to do exactly as you requested.

  7. #7

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,144

    Re: gregorian date convert to hebrew format vb6

    yep sry for that
    can you tell me which function i need to call?
    there is a lot there

  8. #8
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    3,895

    Re: gregorian date convert to hebrew format vb6

    Gosh Salsa, if you took a few seconds to read the given page by Sam:

    Code:
    ' This function converts a Gregorian date into the Hebrew date.  The
    ' function returns the hebrew month as a string in the format MM/DD/YYYY.
    ' Also, the parameters nYearH, nMonthH and hDateH, which are sent by
    ' reference, will get set the Hebrew year, month and date. See function
    ' HebToGreg() for the definition of the month numbers.
    
    Public Function GregToHeb(ByVal dGreg As Date, _
                              ByRef nYearH As Long, _
                              ByRef nMonthH As Long, _
                              ByRef nDateH As Long) As String
    And the last 2 functions...
    Code:
    Public Function TodayHeb()
      Dim nYearH As Long
      Dim nMonthH As Long
      Dim nDateH As Long
      Dim dToday As Date
      
      dToday = Int(Now())
      GregToHeb dToday, nYearH, nMonthH, nDateH
      TodayHeb = FormatDateH(nYearH, nMonthH, nDateH)
    End Function
    
    Public Function DateToHeb(dDate)
      Dim nYearH As Long
      Dim nMonthH As Long
      Dim nDateH As Long
      
      dDate = CDate(dDate)
      GregToHeb dDate, nYearH, nMonthH, nDateH
      DateToHeb = FormatDateH(nYearH, nMonthH, nDateH)
    End Function

  9. #9

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,144

    Re: gregorian date convert to hebrew format vb6

    i read this but it dosnt seem to work
    Code:
    Label1.Caption = HebDateToHeb
    Code:
    Label1.Caption = DateToHeb
    i reed but i tried to call this functions

  10. #10
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    7,453

    Re: gregorian date convert to hebrew format vb6

    Well, I tried it and it works just fine....(as far as I know, that is if today is: Nisan 27 5775)

  11. #11
    Hyperactive Member
    Join Date
    Oct 2013
    Posts
    389

    Re: gregorian date convert to hebrew format vb6

    Nope, what i meant was using .Net Framework ver2.0 via C# or VB.Net to do this, as a quick getaway.
    But seeing SamOscarBrown posted a pure VB6 code you might want to look into his code first.

    I add this source, i wrote this in under a minute it's a small C# code that generates today's hebrew date to a txt file in the executable folder, if it helps you.
    heb_date_to_file.zip

    But again, this kinda 'cheats' using net managed code which can be Shell'd through vb or something, so if you're looking for a pure VB6 solution to this one, might want to stick to SamOscar's solution.
    Last edited by stum; Apr 16th, 2015 at 01:05 PM.

  12. #12
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    7,453

    Re: gregorian date convert to hebrew format vb6

    :-)
    Definitely not MY solution....just me and Google, just me and Google.

  13. #13
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    13,287

    Re: gregorian date convert to hebrew format vb6

    Quote Originally Posted by salsa31 View Post
    i read this but it dosnt seem to work
    Code:
    Label1.Caption = HebDateToHeb
    Code:
    Label1.Caption = DateToHeb
    i reed but i tried to call this functions
    You did not read very well then, clearly the function expects a parameter
    Code:
    Public Function DateToHeb(dDate)

  14. #14

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,144

    Re: gregorian date convert to hebrew format vb6

    sami tnx for the help
    i got the same results as you did but stum got exactly what i was looking for
    DM didnt notice that sir
    Stum
    you code in C# is perfect for me and exactly what i was looking for
    but i dont know C#
    do you have maybe in vb 6 code?

  15. #15
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    7,453

    Re: gregorian date convert to hebrew format vb6

    Quote Originally Posted by SamOscarBrown View Post
    Well, I tried it and it works just fine....(as far as I know, that is if today is: Nisan 27 5775)
    Well, obviously, Google proved again that code works just fine...today IS Nisan 27 5775.

    Why do you want to have someone convert some C-Sharp code for you when Google searches turn up so many working VB6 examples? I know you are not going to write any of it yourself, just copy-paste someone elses (your modus operandi), so why not C-P what I found on Google????

  16. #16

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,144

    Re: gregorian date convert to hebrew format vb6

    sami this result today IS Nisan 27 5775. its not Accurate
    but stum C# is 100 % Accurate
    i have a jewish neighbor who confirmed that

  17. #17
    Hyperactive Member
    Join Date
    Oct 2013
    Posts
    389

    Re: gregorian date convert to hebrew format vb6

    Hey, i believe the problem is that the code i gave you (using .Net libraries I almost feel i need to apologize for this) is using locale, to give you the exact Hebrew date, in Hebrew characters (Hebrew calendar is represented with Hebrew characters, rather than numeric values like the Gregorian) which is why SamOscarBrown's find is just as good but helps less in his specific case.

  18. #18

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,144

    Re: gregorian date convert to hebrew format vb6

    is using locale, to give you the exact Hebrew date, in Hebrew characters (Hebrew calendar is represented with Hebrew characters, rather than numeric
    this exactly what i was looking for
    how did you do that?
    is there a vb 6 code like that?

  19. #19
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    7,453

    Re: gregorian date convert to hebrew format vb6

    Actually, if you RElook (which you probably won't now anyway) at the code in that link, I believe this function (ToHebSt) in there (which hiccupped when I tried) is supposed to do that conversion to Hebrew chars. I had an error and, like I said earlier, I'll probably never to this conversion from Greg to Heb, so simply commented out that and another function.
    If you can resolve that error (forgot what it was), then you have everything you need, I would THINK, based uipon that code---with the exception of locality (IF that applies to Hebrew cals).

    Anyway...outa here. I gave you something to look at and if you want to keep looking at other stuff.....no problem with me. Have a great day.

    Sammi

  20. #20

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,144

    Re: gregorian date convert to hebrew format vb6

    tnx for the help sami
    ii will try it right now and let you know

  21. #21

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,144

    Re: gregorian date convert to hebrew format vb6

    i think i got it
    tnx all for your help and time

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width