Support

Account

Home Forums Front-end Issues Manipulating datepicker data Reply To: Manipulating datepicker data

  • Elliot

    No I haven’t used yymmdd as we need the day of the week to show too. Can I, using the entered data (DyyMd), “reconstruct” it as yymmdd and use that in the get_posts function?

    Code now

    <?php 
     
    		$date = get_field('course_date');
    		// $date = WED2013NOV6 (23/11/1988)
     
    		// extract Y,M,D
    		$D = substr($date, 0, 3);
    		$y = substr($date, 3, 4);
    		$m = substr($date, 7, 3);
    		$d = substr($date, 10, 2);
    		
     
    		// create UNIX
    		$time = strtotime("{$d}-{$m}-{$y}");
     
    		// format date (23/11/1988)
    	 
    		?>
    		<div class="calendar">
    		<p class="calendarDate"><span class="dow"><?php echo $D; ?></span>
    			<span class="day"><?php echo $d; ?> <br /><?php echo $m; ?></span>
    			<span class="year"><?php echo $y; ?></span>
    			</p>
    			</div>

    Cheers

    Pete