how to get system date (VB.Net 2005))-VBForums
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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    89,094

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

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

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    89,094

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

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

    2007-2014

    Why is my data not saved to my database? | MSDN Data Walkthroughs
    MSDN "How Do I?" Videos: VB | C#
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts) | WP8 Turnstile Feather Transition with Pivot Control
    Beginner Tutorials: VB | C# | SQL

  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,241

    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,051

    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,241

    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
    5,006

    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


    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

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

    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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.