Skip to content

Instantly share code, notes, and snippets.

@RonWilliams
Created September 27, 2016 17:58
Show Gist options
  • Save RonWilliams/d89329a6300aa0fce8b7841c6ea425a8 to your computer and use it in GitHub Desktop.
Save RonWilliams/d89329a6300aa0fce8b7841c6ea425a8 to your computer and use it in GitHub Desktop.
DB Query for Updating Drupal Date Fields
update profile_values p
set value = concat( "a:3:{s:5:\"month\";s:", length( date_format(
str_to_date( p.value, "%m/%d/%y" ) , "%c" ) ) , date_format(
str_to_date( p.value, "%m/%d/%y" ) , ":\"%c\";s:3:\"day\";s:" ) ,
length( date_format( str_to_date( p.value, "%m/%d/%y" ) , "%e" ) ) ,
date_format( str_to_date( p.value, "%m/%d/%y" ) ,
":\"%e\";s:4:\"year\";s:4:\"%Y\";}" ) )
WHERE p.value LIKE '%/%/%'
AND p.fid
IN (65);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment