Results 1 to 10 of 10

Thread: how to get system date (VB.Net 2005))

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2008
    Posts
    45

    Post how to get system date (VB.Net 2005))

    Code:
     Dim day1 as date
    i want to get the system date to this day1 variable. how shoud i do that. Please help me

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: how to get system date (VB.Net 2005))

    Date.Now is current date and time. Date.Today is current date.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2008
    Posts
    45

    Re: how to get system date (VB.Net 2005))

    thank you! it worked

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: how to get system date (VB.Net 2005))

    Cool. Don't forget to mark your thread [Resolved] using the Thread Tools menu.

  5. #5
    New Member
    Join Date
    Jul 2013
    Posts
    1

    Re: how to get system date (VB.Net 2005))

    Do anyone know how i can change system time with a text box? i only need to change the year.
    i am completly blank.

  6. #6
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: how to get system date (VB.Net 2005))

    You can't change the system time. It's the system time! You can change the way that it is interpreted but the only reason for doing that is nefarious in intent so I won't be telling you how!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  7. #7
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: how to get system date (VB.Net 2005))

    As far as I know, changing the system time requires a separate API - SetLocalTime. Here's an example: http://www.a1vbcode.com/vbforums/FindPost25051.aspx

  8. #8
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: how to get system date (VB.Net 2005))

    Quote Originally Posted by Zach_VB6 View Post
    As far as I know, changing the system time requires a separate API - SetLocalTime. Here's an example: http://www.a1vbcode.com/vbforums/FindPost25051.aspx
    That might get you into another time zone. It won't transport you back in time by a year!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  9. #9
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: how to get system date (VB.Net 2005))

    You know its funny. I can't think of any recent instance where I actually tried to change the time from code. But I do remember it was definitely possible to do in QuickBasic and in one line no-less. Weird that I haven't actually tried to do that since that those days.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  10. #10
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: how to get system date (VB.Net 2005))

    I'll just throw it out there, that you could simply run a "date xx/xx/xxxx" (or time) command line process that changes the system date.

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