Neurochirurgie minim invazivă
"Primum non nocere" este ideea ce a deschis drumul medicinei spre minim invaziv. Avansul tehnologic extraordinar din ultimele decenii a permis dezvoltarea tuturor domeniilor medicinei. Microscopul operator, neuronavigația, tehnicile anestezice avansate permit intervenții chirurgicale tot mai precise, tot mai sigure. Neurochirurgia minim invazivă, sau prin "gaura cheii", oferă pacienților posibilitatea de a se opera cu riscuri minime, fie ele neurologice, infecțioase, medicale sau estetice. www.neurohope.ro |
Visual Basic - Format Date
Last Updated: May 12 2003 11:28, Started by
AndiOliver
, Mar 01 2003 10:46
·
0
#1
Posted 01 March 2003 - 10:46
Oricine cunoaste visual basic stie ca putem obtine o data intr-un box prin:
textbox = Date Ca sa obtinem automat luna putem scrie: textbox = month(date) Acum vine intrebarea mea: Cum scriem automat saptamana? |
#2
Posted 01 March 2003 - 11:06
Pt. ce vrei tu trebuie sa folosesti functia FORMAT() astfel:
TextBox.text = Format(Date, "ww") Celelalte formaturi se gasesc la : "User-Defined Date/Time Formats (Format Function)" in MSDN Dc ai MSDN-ul : ;rtfm; |
#3
Posted 01 March 2003 - 14:54
Nu este asa: Codul pe care l-ai scris tu va da numarul saptaminii din an, eu incerc sau scot numarul saptaminii din luna respectiva.
Iar in help-ul msdn am cautat indelung, nu am gasit nimic care sa ma ajute. |
#4
Posted 01 March 2003 - 21:13
"Citat" din MSDN . Scuze pt. format i-am dat copy/paste .
Nu stiu dc poti sa afli saptamana din luna curenta . User-Defined Date/Time Formats (Format Function) The following table identifies characters you can use to create user-defined date/time formats: Character Description (:) Time separator. In somelocales, other characters may be used to represent the time separator. The time separator separates hours, minutes, and seconds when time values are formatted. The actual character used as the time separator in formatted output is determined by your system settings. (/) Date separator. In some locales, other characters may be used to represent the date separator. The date separator separates the day, month, and year when date values are formatted. The actual character used as the date separator in formatted output is determined by your system settings. c Display the date as ddddd and display the time as ttttt, in that order. Display only date information if there is no fractional part to the date serial number; display only time information if there is no integer portion. d Display the day as a number without a leading zero (1 – 31). dd Display the day as a number with a leading zero (01 – 31). ddd Display the day as an abbreviation (Sun – Sat). dddd Display the day as a full name (Sunday – Saturday). ddddd Display the date as a complete date (including day, month, and year), formatted according to your system's short date format setting. The default short date format is m/d/yy. dddddd Display a date serial number as a complete date (including day, month, and year) formatted according to the long date setting recognized by your system. The default long date format is mmmm dd, yyyy. w Display the day of the week as a number (1 for Sunday through 7 for Saturday). ww Display the week of the year as a number (1 – 54). m Display the month as a number without a leading zero (1 – 12). If m immediately follows h or hh, the minute rather than the month is displayed. mm Display the month as a number with a leading zero (01 – 12). If m immediately follows h or hh, the minute rather than the month is displayed. mmm Display the month as an abbreviation (Jan – Dec). mmmm Display the month as a full month name (January – December). q Display the quarter of the year as a number (1 – 4). y Display the day of the year as a number (1 – 366). yy Display the year as a 2-digit number (00 – 99). yyyy Display the year as a 4-digit number (100 – 9999). h Display the hour as a number without leading zeros (0 – 23). Hh Display the hour as a number with leading zeros (00 – 23). N Display the minute as a number without leading zeros (0 – 59). Nn Display the minute as a number with leading zeros (00 – 59). S Display the second as a number without leading zeros (0 – 59). Ss Display the second as a number with leading zeros (00 – 59). t t t t t Display a time as a complete time (including hour, minute, and second), formatted using the time separator defined by the time format recognized by your system. A leading zero is displayed if the leading zero option is selected and the time is before 10:00 A.M. or P.M. The default time format is h:mm:ss. AM/PM Use the 12-hour clock and display an uppercase AM with any hour before noon; display an uppercase PM with any hour between noon and 11:59 P.M. am/pm Use the 12-hour clock and display a lowercase AM with any hour before noon; display a lowercase PM with any hour between noon and 11:59 P.M. A/P Use the 12-hour clock and display an uppercase A with any hour before noon; display an uppercase P with any hour between noon and 11:59 P.M. a/p Use the 12-hour clock and display a lowercase A with any hour before noon; display a lowercase P with any hour between noon and 11:59 P.M. AMPM Use the 12-hour clock and display the AMstring literal as defined by your system with any hour before noon; display the PM string literal as defined by your system with any hour between noon and 11:59 P.M. AMPM can be either uppercase or lowercase, but the case of the string displayed matches the string as defined by your system settings. The default format is AM/PM. |
#5
Posted 04 March 2003 - 09:05
Eu am citit enough MSDN, repet nu am vazut nici o posibilitate pentru ca sa obtin numarul saptaminii din luna respectiva. La aceasta ora programele create de mine folosesc input-ul user-ului pentru acest lucru.
|
#6
Posted 04 March 2003 - 09:53
nu are cum sa fie nici o functie sistem.
Dar eu nu inteleg...nu poti imparti la 7 numarul zilei ? :) Chiar sa ceri input de la user pt asa ceva e cam...aberant. Apropos, conform ISO, prima saptamana din an este considerata prima care contine o zi de marti. |
#7
Posted 04 March 2003 - 13:37
Quote Originally posted by menetz nu are cum sa fie nici o functie sistem. Quote Originally posted by menetz Apropos, conform ISO, prima saptamana din an este considerata prima care contine o zi de marti. |
#8
Posted 04 March 2003 - 15:49
nu are legatura..eu ma referam la calcularea saptamanii din an, cand e nevoie, si care e prima saptamana considerata.
|
#9
Posted 05 March 2003 - 11:17
Personal am incercat toate modalitatile posibile, am incercat si asta spusa de tine, care am mai auzit-o si pe un alt forum ( nu spun numele ca sa nu fac reclama gratuita), dar problema este ca nu functioneaza, cel putin nu intotdeauna.
La mine luna se pune automat iar userul nici nu mai are voie sa umble la numarul lunii, daca fac acest lucru si pentru numarul saptamanii din luna respectiva, la fel nu mai las user-ul sa umble nici la aceasta setare, problema este ca imi trebuie un rezultat corect 100% din cazuri..... |
#10
Posted 09 April 2003 - 14:15
Andi,
a) obtzii numaru' saptamanii pentru data curenta folosind "ww" creezi o data noua cu ziua de 1 shi luna shi anu' obtzinute prin "mm" shi "yyyy". obtzii numaru saptamanii pentru data asta prin "ww". faci diferentza. B) nu-mi dau seama inca daca la a) sunt exceptzii care itzi dau calculul peste cap. daca da, ia o metoda mai lunga, dar sigura. obtzii day-of-week pentru data de 1 a lunii curente (vezi a). extragi din data (potzi shi prin substring) ziua din luna. pe baza unui algoritm simplist care tzine cont de prima zi a saptamanii (monday/sunday etc) shi cele de mai sus vei obtzine saptamana curenta. |
|
#11
Posted 07 May 2003 - 12:49
Imi cer scuze pentru intarzierea raspunsului, au existat anumite probleme ce m-au facut sa nu mai accesez forumul pentru ceva vreme.
Sa fiu sincer aphex nu inteleg, in schimb mi-ar fi de ajutor daca ai scrie liniile respective de cod sa le inteleg pe cale empirica. Multumesc in avans. |
#12
Posted 07 May 2003 - 13:21
O solutie simpla mi se pare a fi parcurgerea urmatorilor pasi:
- afli in ce saptamana a anului se afla ziua de intai a lunii (intA) - afli in ce saptamana a anului se afla ziua care te intereseaza (intB) - obtii saptamana din luna aplicand formula: x = intB - intA +1 Exemplu: Function WeekOfTheMonth(datInput As Date) As Integer 'Returns: The week of the month 'Author: Nic Dobre, [email protected] Dim d As Date Dim intWeekNrOne As Integer d = datInput - DatePart("d", datInput) + 1 intWeekNrOne = DatePart("ww", d) WeekOfTheMonth = DatePart("ww", datInput) - intWeekNrOne End Function |
#13
Posted 07 May 2003 - 13:43
scuza-mi hardcodingu', vb-ul nu este limbaju' meu favorit, daca ai intrebari sau vrei sa extindem codul spune-mi, aici am ilustrat doar algoritmii:
' assumes us date format Private Sub Form_Load() MsgBox CStr(GetWeek1()) MsgBox CStr(GetWeek2()) End Sub Private Function GetWeek1() As Integer Dim today As Date Dim newdate As Date Dim w1 As Integer, w2 As Integer Dim m As String, y As String today = Now() w1 = CInt(DatePart("ww", today)) m = CStr(DatePart("m", today)) y = CStr(DatePart("yyyy", today)) newdate = DateValue(m & "/1/" & y) w2 = CInt(DatePart("ww", newdate)) GetWeek1 = w1 - w2 + 1 End Function Private Function GetWeek2() As Integer Dim today As Date Dim newdate As Date Dim w As Integer, d As Integer Dim m As String, y As String today = Now() m = CStr(DatePart("m", today)) y = CStr(DatePart("yyyy", today)) newdate = DateValue(m & "/1/" & y) w = CInt(DatePart("w", newdate)) d = CInt(DatePart("d", today)) GetWeek2 = Int((w + d - 2) / 7) + 1 End Function PS: nostradamnus, daca citeai ce am zis io la a) vedeai ca ai zis ce am zis shi io PPS: aduna shi tu un "1" la sfarshit, altfel numeri saptamanile incepand de la zero |
#14
Posted 07 May 2003 - 13:52
da aphex, ai dreptate in ambele privinte.
Linia: WeekOfTheMonth = DatePart("ww", datInput) - intWeekNrOne se schimba in: WeekOfTheMonth = DatePart("ww", datInput) - intWeekNrOne+1 daca te uiti in algoritm am prevazut asta; la implementare... ce vrei dom'le, caldura mare! ;-) ai dreptate, ai propus inaintea mea aceasta varianta. Am vazut dupa ce am postat. Prin urmare, acord share de copiright... LOL. |
#16
Posted 12 May 2003 - 11:28
Va multumesc pentru efortul depus in a ma ajuta. Voi incerca sa analizez(invat - pe cit posibil) codul produs de voi si astfel sa-l implementez pentru a-mi rezolva problema.
|
Anunturi
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users