dede11
asked on
retrive the number of month from date field ....
hi
I have a date field suppose (dateField) that I am attempting to use a query to determine the number of month....
for example, if the (dateField) is 30\4\1405 , I want to run a query that will return the month (i.e. 4).
thanks ....:)
I have a date field suppose (dateField) that I am attempting to use a query to determine the number of month....
for example, if the (dateField) is 30\4\1405 , I want to run a query that will return the month (i.e. 4).
thanks ....:)
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Links I found useful in the past...
http://office.microsoft.com/en-ca/assistance/HP052579221033.aspx
http://www.thescripts.com/forum/thread201790.html
http://office.microsoft.com/en-ca/assistance/HP052579221033.aspx
http://www.thescripts.com/forum/thread201790.html
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
As to this source:
http://www.islamicfinder.org/hijri_intro.php
this calender is not exact:
"Since the Islamic calendar is purely lunar, as apposed to solar or luni-solar,
the Muslim (Hijri) year is shorter than the Gregorian year by about 11 days .."
thus you'll have to run your own conversion routine, or convert it to the Gregorian calender where you can use the Month() function - but these months are different from yours ...
/gustav
http://www.islamicfinder.org/hijri_intro.php
this calender is not exact:
"Since the Islamic calendar is purely lunar, as apposed to solar or luni-solar,
the Muslim (Hijri) year is shorter than the Gregorian year by about 11 days .."
thus you'll have to run your own conversion routine, or convert it to the Gregorian calender where you can use the Month() function - but these months are different from yours ...
/gustav
Hello,
If the date is stored as text in your database, you want to extract a portion of that string using the backslash delimiter. The following function can help:
Function HijriDatePart(pvarDate, pintPart As Integer)
On Error Resume Next
HijriDatePart = Null
HijriDatePart = CInt(Val(Split(pvarDate, "\")(pintPart)))
End Function
Place it in a module and you can then use it in a query, noting that the day is part 0, the month part 1 and the year part 2.
HijriMonth: HijriDatePart( strTheDateField, 1 )
You can also do it all in a query expression, but it gets a little messy:
HijriMonth: Val(Mid(Left([strField],In Str(InStr( [strField] ,'\')+1,[s trField],' \')),InStr ([strField ],'\')+1))
Hope this helps
(°v°)
If the date is stored as text in your database, you want to extract a portion of that string using the backslash delimiter. The following function can help:
Function HijriDatePart(pvarDate, pintPart As Integer)
On Error Resume Next
HijriDatePart = Null
HijriDatePart = CInt(Val(Split(pvarDate, "\")(pintPart)))
End Function
Place it in a module and you can then use it in a query, noting that the day is part 0, the month part 1 and the year part 2.
HijriMonth: HijriDatePart( strTheDateField, 1 )
You can also do it all in a query expression, but it gets a little messy:
HijriMonth: Val(Mid(Left([strField],In
Hope this helps
(°v°)
ASKER
Hello experts ...
thanks for response ...,
Month(datefield).........a
thanks again.. :)
ASKER