+ Reply to Thread
Results 1 to 4 of 4

convert todays date to a MYSQL timestamp format

  1. #1
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    convert todays date to a MYSQL timestamp format

    I am trying to convert today?s date to a MYSQL timestamp format
    the code I?m using to make the MYSQL timestamp format is

    myTimestamp = Date
    myTimestamp = Format(myTimestamp, "yyyy-mm-dd")

    However when I send information to MySQL I get an empty date.
    What am I doing wrong?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: convert todays date to a MYSQL timestamp format

    How is myTimestamp declared? You should declare all your variables and the result must be a String. Also you can put Date right in the Format call, no intermediate assignment necessary..

    My recommendation is

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    05-30-2013
    Location
    Isreal
    MS-Off Ver
    Excel 2010
    Posts
    191

    Re: convert todays date to a MYSQL timestamp format

    Thank you for your help
    I used the following code and it worked

    Please Login or Register  to view this content.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: convert todays date to a MYSQL timestamp format

    That is different than your original question. Also, there is still no need to use an intermediate variable. You can just put Now directly in the Format call.

    Also I'll repeat that variables should be declared. I strongly recommend to everyone that they use Option Explicit and declare variables. Doing so prevents a lot of bugs and runtime errors.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Convert timestamp to date
    By phodges in forum Excel General
    Replies: 6
    Last Post: 07-16-2021, 03:49 AM
  2. [SOLVED] convert today's day to value (date format) using VBA
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 04-14-2019, 09:33 AM
  3. Replies: 2
    Last Post: 06-09-2018, 11:21 AM
  4. Convert Timestamp to date.
    By brent_milne in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-09-2015, 01:31 PM
  5. Convert timestamp to date
    By brent_milne in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-29-2015, 10:02 PM
  6. [SOLVED] VBA - Convert Date/Timestamp into American Date and Military Timestamp
    By ryanmorris in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-01-2015, 03:43 PM
  7. Convert Timestamp vaule to date
    By dpatel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-23-2010, 06:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1