Ask Experts Questions for FREE Help !
Ask
    Mistery1's Avatar
    Mistery1 Posts: 39, Reputation: 1
    Junior Member
     
    #1

    Nov 20, 2009, 05:19 AM
    Date Time format
    Hi there,

    I know MySql is already to take YYYY-MM-DD HH:MM:SS. Therefore I need to write code to change this format when saving into MySql database from my asp.net/vb application.

    I have this code that does not work. It still saves as all zeros to the database. Does anyone have any clue hot to change this format to dd-mm-yyyy in the database?

    Dim dateStr As String

    dateStr = DateTime.Now.Month & "-"
    dateStr &= DateTime.Now.Day & "-"
    dateStr &= DateTime.Now.Year & " "
    dateStr &= DateTime.Now.Hour & ":"
    dateStr &= DateTime.Now.Minute & ":"
    dateStr &= DateTime.Now.Second &
    slapshot_oi's Avatar
    slapshot_oi Posts: 1,537, Reputation: 589
    Ultra Member
     
    #2

    Nov 20, 2009, 05:53 AM
    You're reinventing the wheel with your function. There are routines that .Net has in place that deal with date formats: Standard DateTime Format Strings. And here is a cheat sheet.
    gc69172's Avatar
    gc69172 Posts: 1, Reputation: 1
    New Member
     
    #3

    Nov 25, 2010, 02:47 AM
    Yes you can use the toshortdate format in C#/Vb to do so. See the available options in the date format then you can do it.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

SAS code to Format decimal places and julian date [ 2 Answers ]

I am working with a data set that I would like to link with another data set. However, I need to do two thing before linking the two data set together. One is that I have a variable claim that I need to format. The variable has values 250, 5525 etc and I need to place a period to make it 2.50,...

How do I set the day, time and date on a Seiko World Time Touch sensor [ 5 Answers ]

Setting the date, time and day on a Seiko World Time Touch Sensor with 3 buttons in the back

Access: Date Format using slashes but america dates come up [ 6 Answers ]

I want for e.g.. 02/11/07 applied to my dates. ( 2nd November 07) How do I customise it. Help appreciated using slashes and days before month

Wrong date format I can't change. [ 8 Answers ]

I'm using MS Works 8.5. When I click on Format/Number/Date the exact format I want is not shown and the preview is often different from that. i.e. it shows as say 31/8/07 and I want 8/31/07 as I'm in Australia. How can I change it to what I want? Help would be much appreciated. Stuartp77


View more questions Search