تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
اكواد التاريخ والوقت
#1
كاتب الموضوع : SUB NEW


اليكم الاكواد التاليه

Dim thirdOfJuly As Date = #7/3/1776 11:59:59 PM#


كود :
[color=#000000][COLOR=#0000bb] [/color][color=#007700]Public Class [/color][COLOR=#0000bb]Tester  
    [/COLOR][color=#007700]Public [/color][COLOR=#0000bb]Shared Sub Main  
        Dim thirdOfJuly [/COLOR][color=#007700]As [/color][color=#0000bb]Date [/color][color=#007700]= [/color][COLOR=#ff8000]#7/3/1776 11:59:59 PM#  
        [/COLOR][color=#0000bb]Dim fourthOfJuly [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][COLOR=#007700])  
        [/COLOR][color=#0000bb]Dim inTheMorning [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][color=#007700], [/color][color=#0000bb]9[/color][color=#007700], [/color][color=#0000bb]45[/color][color=#007700], [/color][color=#0000bb]30[/color][COLOR=#007700])  

        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]( [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"The 3rd and 4th of July, 1776..." [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           vbNewLine [/COLOR][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"#7/3/1776 11:59:59 PM# ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           thirdOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           fourthOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4, 9, 45, 30) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           inTheMorning[/COLOR][color=#007700].[/color][color=#0000bb]ToString[/color][COLOR=#007700])  
    [/COLOR][COLOR=#0000bb]End Sub  

End [/COLOR][COLOR=#007700]Class  
[/COLOR][color=#0000bb][/color][/COLOR]

Dim fourthOfJuly As New Date(1776, 7, 4)


كود :
[color=#000000][COLOR=#0000bb][/color][color=#007700]Public Class [/color][COLOR=#0000bb]Tester  
    [/COLOR][color=#007700]Public [/color][COLOR=#0000bb]Shared Sub Main  
        Dim thirdOfJuly [/COLOR][color=#007700]As [/color][color=#0000bb]Date [/color][color=#007700]= [/color][COLOR=#ff8000]#7/3/1776 11:59:59 PM#  
        [/COLOR][color=#0000bb]Dim fourthOfJuly [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][COLOR=#007700])  
        [/COLOR][color=#0000bb]Dim inTheMorning [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][color=#007700], [/color][color=#0000bb]9[/color][color=#007700], [/color][color=#0000bb]45[/color][color=#007700], [/color][color=#0000bb]30[/color][COLOR=#007700])  

        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]( [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"The 3rd and 4th of July, 1776..." [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           vbNewLine [/COLOR][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"#7/3/1776 11:59:59 PM# ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           thirdOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           fourthOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4, 9, 45, 30) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           inTheMorning[/COLOR][color=#007700].[/color][color=#0000bb]ToString[/color][COLOR=#007700])  
    [/COLOR][COLOR=#0000bb]End Sub  

End [/COLOR][COLOR=#007700]Class  
[/COLOR][color=#0000bb][/color][/COLOR]

Dim inTheMorning As New Date(1776, 7, 4, 9, 45, 30)


كود :
[color=#000000][COLOR=#0000bb][/color][color=#007700]Public Class [/color][COLOR=#0000bb]Tester  
    [/COLOR][color=#007700]Public [/color][COLOR=#0000bb]Shared Sub Main  
        Dim thirdOfJuly [/COLOR][color=#007700]As [/color][color=#0000bb]Date [/color][color=#007700]= [/color][COLOR=#ff8000]#7/3/1776 11:59:59 PM#  
        [/COLOR][color=#0000bb]Dim fourthOfJuly [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][COLOR=#007700])  
        [/COLOR][color=#0000bb]Dim inTheMorning [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][color=#007700], [/color][color=#0000bb]9[/color][color=#007700], [/color][color=#0000bb]45[/color][color=#007700], [/color][color=#0000bb]30[/color][COLOR=#007700])  

        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]( [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"The 3rd and 4th of July, 1776..." [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           vbNewLine [/COLOR][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"#7/3/1776 11:59:59 PM# ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           thirdOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           fourthOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4, 9, 45, 30) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           inTheMorning[/COLOR][color=#007700].[/color][color=#0000bb]ToString[/color][COLOR=#007700])  
    [/COLOR][COLOR=#0000bb]End Sub  

End [/COLOR][COLOR=#007700]Class  
[/COLOR][color=#0000bb][/color][/COLOR]

dateVariable = #1/1/2004#


كود :
[color=#000000][COLOR=#0000bb][/color][color=#007700]public class [/color][COLOR=#0000bb]Test  
   [/COLOR][color=#007700]public [/color][COLOR=#0000bb]Shared Sub Main  


        Dim dteExpiration [/COLOR][color=#007700]As [/color][COLOR=#0000bb]Date  

        dteExpiration [/COLOR][color=#007700]= [/color][COLOR=#ff8000]#1/1/2004#  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#0000bb]dteExpiration[/color][COLOR=#007700])  


   [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]class  
[/COLOR][color=#0000bb][/color][/COLOR]

dateVariable = #8/27/2001 6:29:11 PM#


كود :
[color=#000000][COLOR=#0000bb] [/color][color=#007700]public class [/color][COLOR=#0000bb]Test  
   [/COLOR][color=#007700]public [/color][COLOR=#0000bb]Shared Sub Main  


        Dim dteExpiration [/COLOR][color=#007700]As [/color][COLOR=#0000bb]Date  

        dteExpiration [/COLOR][color=#007700]= [/color][COLOR=#ff8000]#8/27/2001 6:29:11 PM#  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#0000bb]dteExpiration[/color][COLOR=#007700])  

   [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]class  
[/COLOR][color=#0000bb][/color][/COLOR]

dateVariable = 'July 2, 2002'


كود :
[color=#000000][COLOR=#0000bb] [/color][color=#007700]public class [/color][COLOR=#0000bb]Test  
   [/COLOR][color=#007700]public [/color][COLOR=#0000bb]Shared Sub Main  


        Dim dteExpiration [/COLOR][color=#007700]As [/color][COLOR=#0000bb]Date  

        dteExpiration [/COLOR][color=#007700]= [/color][COLOR=#dd0000]"July 2, 2002"  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#0000bb]dteExpiration[/color][COLOR=#007700])  



   [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]class  
[/COLOR][color=#0000bb][/color][/COLOR]

Add 3 years to a date اضافه ثلاث سنوات الى التاريخ


كود :
[color=#000000][COLOR=#0000bb] [/color][color=#007700]public class [/color][COLOR=#0000bb]Test  
   [/COLOR][color=#007700]public [/color][COLOR=#0000bb]Shared Sub Main  

        Dim Expiration [/COLOR][color=#007700]As [/color][COLOR=#0000bb]Date  
        Dim NewExpiration [/COLOR][color=#007700]As [/color][COLOR=#0000bb]Date  

        Expiration [/COLOR][color=#007700]= [/color][COLOR=#ff8000]#1/1/2005#  
        [/COLOR][color=#0000bb]Expiration[/color][color=#007700].[/color][color=#0000bb]AddYears[/color][color=#007700]([/color][color=#0000bb]3[/color][COLOR=#007700])  
        [/COLOR][color=#0000bb]NewExpiration [/color][color=#007700]= [/color][color=#0000bb]Expiration[/color][color=#007700].[/color][color=#0000bb]AddYears[/color][color=#007700]([/color][color=#0000bb]3[/color][COLOR=#007700])  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"The new expiration date is: " [/color][color=#007700]& [/color][color=#0000bb]NewExpiration[/color][COLOR=#007700])  

   [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]class  
[/COLOR][color=#0000bb][/color][/COLOR]

Date AddYears, AddMonths and AddDays
التاريخ بالفورمات الاتيه
السنه والشهر واليوم



كود :
[color=#000000][COLOR=#0000bb] [/color][color=#007700]Public Class [/color][COLOR=#0000bb]Tester  
    [/COLOR][color=#007700]Public [/color][COLOR=#0000bb]Shared Sub Main  
          
        Dim rightNow [/COLOR][color=#007700]As [/color][color=#0000bb]Date [/color][color=#007700]= [/color][COLOR=#0000bb]Now  

        Console[/COLOR][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow: " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]ToString[/color][COLOR=#007700])  

        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddYears(2): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddYears[/color][color=#007700]([/color][color=#0000bb]2[/color][COLOR=#007700]))  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddMonths(3): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddMonths[/color][color=#007700]([/color][color=#0000bb]3[/color][COLOR=#007700]))  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddDays(4): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddDays[/color][color=#007700]([/color][color=#0000bb]4[/color][COLOR=#007700]))  
    [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]Class  
[/COLOR][color=#0000bb][/color][/COLOR]

Add Time to current time
اضافه وقت الى الوقت الحالى


كود :
[color=#000000][COLOR=#0000bb][/color][color=#007700]Public Class [/color][COLOR=#0000bb]Tester  
    [/COLOR][color=#007700]Public [/color][COLOR=#0000bb]Shared Sub Main  
          
        Dim rightNow [/COLOR][color=#007700]As [/color][color=#0000bb]Date [/color][color=#007700]= [/color][COLOR=#0000bb]Now  

        Console[/COLOR][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow: " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]ToString[/color][COLOR=#007700])  

         ----- [/COLOR][color=#0000bb]Add time values[/color][COLOR=#007700].  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddHours(5): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddHours[/color][color=#007700]([/color][color=#0000bb]5[/color][COLOR=#007700]))  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddMinutes(6): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddMinutes[/color][color=#007700]([/color][color=#0000bb]6[/color][COLOR=#007700]))  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddSeconds(7): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddSeconds[/color][color=#007700]([/color][color=#0000bb]7[/color][COLOR=#007700]))  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddMilliseconds(8000): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddMilliseconds[/color][color=#007700]([/color][color=#0000bb]8000[/color][COLOR=#007700]))  
    [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]Class  
[/COLOR][color=#0000bb][/color][/COLOR]

يتبع....................

باقى الاكواد فى ملف نصى مرفق

تحياتى وبالتوفيق للجميع
اليكم الاكواد التاليه

Dim thirdOfJuly As Date = #7/3/1776 11:59:59 PM#


كود :
[color=#000000][COLOR=#0000bb] [/color][color=#007700]Public Class [/color][COLOR=#0000bb]Tester  
    [/COLOR][color=#007700]Public [/color][COLOR=#0000bb]Shared Sub Main  
        Dim thirdOfJuly [/COLOR][color=#007700]As [/color][color=#0000bb]Date [/color][color=#007700]= [/color][COLOR=#ff8000]#7/3/1776 11:59:59 PM#  
        [/COLOR][color=#0000bb]Dim fourthOfJuly [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][COLOR=#007700])  
        [/COLOR][color=#0000bb]Dim inTheMorning [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][color=#007700], [/color][color=#0000bb]9[/color][color=#007700], [/color][color=#0000bb]45[/color][color=#007700], [/color][color=#0000bb]30[/color][COLOR=#007700])  

        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]( [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"The 3rd and 4th of July, 1776..." [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           vbNewLine [/COLOR][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"#7/3/1776 11:59:59 PM# ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           thirdOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           fourthOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4, 9, 45, 30) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           inTheMorning[/COLOR][color=#007700].[/color][color=#0000bb]ToString[/color][COLOR=#007700])  
    [/COLOR][COLOR=#0000bb]End Sub  

End [/COLOR][COLOR=#007700]Class  
[/COLOR][color=#0000bb][/color][/COLOR]

Dim fourthOfJuly As New Date(1776, 7, 4)


كود :
[color=#000000][COLOR=#0000bb][/color][color=#007700]Public Class [/color][COLOR=#0000bb]Tester  
    [/COLOR][color=#007700]Public [/color][COLOR=#0000bb]Shared Sub Main  
        Dim thirdOfJuly [/COLOR][color=#007700]As [/color][color=#0000bb]Date [/color][color=#007700]= [/color][COLOR=#ff8000]#7/3/1776 11:59:59 PM#  
        [/COLOR][color=#0000bb]Dim fourthOfJuly [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][COLOR=#007700])  
        [/COLOR][color=#0000bb]Dim inTheMorning [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][color=#007700], [/color][color=#0000bb]9[/color][color=#007700], [/color][color=#0000bb]45[/color][color=#007700], [/color][color=#0000bb]30[/color][COLOR=#007700])  

        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]( [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"The 3rd and 4th of July, 1776..." [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           vbNewLine [/COLOR][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"#7/3/1776 11:59:59 PM# ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           thirdOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           fourthOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4, 9, 45, 30) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           inTheMorning[/COLOR][color=#007700].[/color][color=#0000bb]ToString[/color][COLOR=#007700])  
    [/COLOR][COLOR=#0000bb]End Sub  

End [/COLOR][COLOR=#007700]Class  
[/COLOR][color=#0000bb][/color][/COLOR]

Dim inTheMorning As New Date(1776, 7, 4, 9, 45, 30)


كود :
[color=#000000][COLOR=#0000bb][/color][color=#007700]Public Class [/color][COLOR=#0000bb]Tester  
    [/COLOR][color=#007700]Public [/color][COLOR=#0000bb]Shared Sub Main  
        Dim thirdOfJuly [/COLOR][color=#007700]As [/color][color=#0000bb]Date [/color][color=#007700]= [/color][COLOR=#ff8000]#7/3/1776 11:59:59 PM#  
        [/COLOR][color=#0000bb]Dim fourthOfJuly [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][COLOR=#007700])  
        [/COLOR][color=#0000bb]Dim inTheMorning [/color][color=#007700]As New [/color][color=#0000bb]Date[/color][color=#007700]([/color][color=#0000bb]1776[/color][color=#007700], [/color][color=#0000bb]7[/color][color=#007700], [/color][color=#0000bb]4[/color][color=#007700], [/color][color=#0000bb]9[/color][color=#007700], [/color][color=#0000bb]45[/color][color=#007700], [/color][color=#0000bb]30[/color][COLOR=#007700])  

        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]( [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"The 3rd and 4th of July, 1776..." [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           vbNewLine [/COLOR][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"#7/3/1776 11:59:59 PM# ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           thirdOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           fourthOfJuly[/COLOR][color=#007700].[/color][color=#0000bb]ToString [/color][color=#007700]& [/color][color=#0000bb]vbNewLine [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           [/COLOR][color=#dd0000]"New Date(1776, 7, 4, 9, 45, 30) ... " [/color][color=#007700]& [/color][COLOR=#0000bb]_  
           inTheMorning[/COLOR][color=#007700].[/color][color=#0000bb]ToString[/color][COLOR=#007700])  
    [/COLOR][COLOR=#0000bb]End Sub  

End [/COLOR][COLOR=#007700]Class  
[/COLOR][color=#0000bb][/color][/COLOR]

dateVariable = #1/1/2004#


كود :
[color=#000000][COLOR=#0000bb][/color][color=#007700]public class [/color][COLOR=#0000bb]Test  
   [/COLOR][color=#007700]public [/color][COLOR=#0000bb]Shared Sub Main  


        Dim dteExpiration [/COLOR][color=#007700]As [/color][COLOR=#0000bb]Date  

        dteExpiration [/COLOR][color=#007700]= [/color][COLOR=#ff8000]#1/1/2004#  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#0000bb]dteExpiration[/color][COLOR=#007700])  


   [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]class  
[/COLOR][color=#0000bb][/color][/COLOR]

dateVariable = #8/27/2001 6:29:11 PM#


كود :
[color=#000000][COLOR=#0000bb] [/color][color=#007700]public class [/color][COLOR=#0000bb]Test  
   [/COLOR][color=#007700]public [/color][COLOR=#0000bb]Shared Sub Main  


        Dim dteExpiration [/COLOR][color=#007700]As [/color][COLOR=#0000bb]Date  

        dteExpiration [/COLOR][color=#007700]= [/color][COLOR=#ff8000]#8/27/2001 6:29:11 PM#  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#0000bb]dteExpiration[/color][COLOR=#007700])  

   [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]class  
[/COLOR][color=#0000bb][/color][/COLOR]

dateVariable = 'July 2, 2002'


كود :
[color=#000000][COLOR=#0000bb] [/color][color=#007700]public class [/color][COLOR=#0000bb]Test  
   [/COLOR][color=#007700]public [/color][COLOR=#0000bb]Shared Sub Main  


        Dim dteExpiration [/COLOR][color=#007700]As [/color][COLOR=#0000bb]Date  

        dteExpiration [/COLOR][color=#007700]= [/color][COLOR=#dd0000]"July 2, 2002"  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#0000bb]dteExpiration[/color][COLOR=#007700])  



   [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]class  
[/COLOR][color=#0000bb][/color][/COLOR]

Add 3 years to a date اضافه ثلاث سنوات الى التاريخ


كود :
[color=#000000][COLOR=#0000bb] [/color][color=#007700]public class [/color][COLOR=#0000bb]Test  
   [/COLOR][color=#007700]public [/color][COLOR=#0000bb]Shared Sub Main  

        Dim Expiration [/COLOR][color=#007700]As [/color][COLOR=#0000bb]Date  
        Dim NewExpiration [/COLOR][color=#007700]As [/color][COLOR=#0000bb]Date  

        Expiration [/COLOR][color=#007700]= [/color][COLOR=#ff8000]#1/1/2005#  
        [/COLOR][color=#0000bb]Expiration[/color][color=#007700].[/color][color=#0000bb]AddYears[/color][color=#007700]([/color][color=#0000bb]3[/color][COLOR=#007700])  
        [/COLOR][color=#0000bb]NewExpiration [/color][color=#007700]= [/color][color=#0000bb]Expiration[/color][color=#007700].[/color][color=#0000bb]AddYears[/color][color=#007700]([/color][color=#0000bb]3[/color][COLOR=#007700])  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"The new expiration date is: " [/color][color=#007700]& [/color][color=#0000bb]NewExpiration[/color][COLOR=#007700])  

   [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]class  
[/COLOR][color=#0000bb][/color][/COLOR]

Date AddYears, AddMonths and AddDays
التاريخ بالفورمات الاتيه
السنه والشهر واليوم



كود :
[color=#000000][COLOR=#0000bb] [/color][color=#007700]Public Class [/color][COLOR=#0000bb]Tester  
    [/COLOR][color=#007700]Public [/color][COLOR=#0000bb]Shared Sub Main  
          
        Dim rightNow [/COLOR][color=#007700]As [/color][color=#0000bb]Date [/color][color=#007700]= [/color][COLOR=#0000bb]Now  

        Console[/COLOR][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow: " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]ToString[/color][COLOR=#007700])  

        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddYears(2): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddYears[/color][color=#007700]([/color][color=#0000bb]2[/color][COLOR=#007700]))  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddMonths(3): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddMonths[/color][color=#007700]([/color][color=#0000bb]3[/color][COLOR=#007700]))  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddDays(4): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddDays[/color][color=#007700]([/color][color=#0000bb]4[/color][COLOR=#007700]))  
    [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]Class  
[/COLOR][color=#0000bb][/color][/COLOR]

Add Time to current time
اضافه وقت الى الوقت الحالى


كود :
[color=#000000][COLOR=#0000bb][/color][color=#007700]Public Class [/color][COLOR=#0000bb]Tester  
    [/COLOR][color=#007700]Public [/color][COLOR=#0000bb]Shared Sub Main  
          
        Dim rightNow [/COLOR][color=#007700]As [/color][color=#0000bb]Date [/color][color=#007700]= [/color][COLOR=#0000bb]Now  

        Console[/COLOR][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow: " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]ToString[/color][COLOR=#007700])  

         ----- [/COLOR][color=#0000bb]Add time values[/color][COLOR=#007700].  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddHours(5): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddHours[/color][color=#007700]([/color][color=#0000bb]5[/color][COLOR=#007700]))  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddMinutes(6): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddMinutes[/color][color=#007700]([/color][color=#0000bb]6[/color][COLOR=#007700]))  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddSeconds(7): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddSeconds[/color][color=#007700]([/color][color=#0000bb]7[/color][COLOR=#007700]))  
        [/COLOR][color=#0000bb]Console[/color][color=#007700].[/color][color=#0000bb]WriteLine[/color][color=#007700]([/color][color=#dd0000]"RightNow.AddMilliseconds(8000): " [/color][color=#007700]& [/color][color=#0000bb]rightNow[/color][color=#007700].[/color][color=#0000bb]AddMilliseconds[/color][color=#007700]([/color][color=#0000bb]8000[/color][COLOR=#007700]))  
    [/COLOR][COLOR=#0000bb]End Sub  
End [/COLOR][COLOR=#007700]Class  
[/COLOR][color=#0000bb][/color][/COLOR]

يتبع....................



الملفات المرفقة
.txt   اكواد التاريخ و&#1.txt (الحجم : 10.72 ك ب / التحميلات : 47)
}}}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  اكواد منوعه في Vb.net RaggiTech 0 603 17-10-12, 09:10 PM
آخر رد: RaggiTech
  اكواد فيجوال بيسك نت 2005 RaggiTech 0 1,231 17-10-12, 09:07 PM
آخر رد: RaggiTech
  مثال - تحويل التاريخ من ميلادي الى هجري وبالعكس في الفيجول دوت نت 2008 RaggiTech 0 1,198 17-10-12, 08:34 PM
آخر رد: RaggiTech
  مثال رائع من مايكروسوفت يوضح اكواد التعامل مع الملفات و بتصميم ممتاز(80ك ب) RaggiTech 0 415 17-10-12, 07:19 PM
آخر رد: RaggiTech
  لحساب العمر الكامل بدلالة التاريخ RaggiTech 0 470 17-10-12, 05:28 PM
آخر رد: RaggiTech
  كيفية تحويل التاريخ من هجري إلى ميلادي - VB.net RaggiTech 0 1,861 17-10-12, 05:17 PM
آخر رد: RaggiTech

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم