Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. mysql date

mysql date

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
helpdatabasemysqlquestion
3 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    UD IA
    wrote on last edited by
    #1

    hi i have a problem with my sql i have a field date and its not mandatory field show user can leave this field blank but when i store this i found and error not data in correct format and if i use 0000-00-00 then its store value 1/1/1970. while i want not use this date. thanks in advance. :-D

    I will do my best? Integrated Solutions, Bikaner (Raj.), India

    P 1 Reply Last reply
    0
    • U UD IA

      hi i have a problem with my sql i have a field date and its not mandatory field show user can leave this field blank but when i store this i found and error not data in correct format and if i use 0000-00-00 then its store value 1/1/1970. while i want not use this date. thanks in advance. :-D

      I will do my best? Integrated Solutions, Bikaner (Raj.), India

      P Offline
      P Offline
      Perspx
      wrote on last edited by
      #2

      You could always make this field a VARCHAR (10) instead, which means that the field can take a null value; then, just insert any actual dates in the format YYYY-MM-DD, leaving fields blank where you want to, and then when you read the data from the database again, check if it's not null and if so parse it using a function like date_parse(). Regards, --Perspx

      "I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
      "Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds

      U 1 Reply Last reply
      0
      • P Perspx

        You could always make this field a VARCHAR (10) instead, which means that the field can take a null value; then, just insert any actual dates in the format YYYY-MM-DD, leaving fields blank where you want to, and then when you read the data from the database again, check if it's not null and if so parse it using a function like date_parse(). Regards, --Perspx

        "I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
        "Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds

        U Offline
        U Offline
        umeshdaiya
        wrote on last edited by
        #3

        thanks for reply.:rose:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups