How to get the Date Format and Time Format settings for use in my template?

This is a strange question, but I want to know how I can access the Date and Time settings

Admin > Settings > General > Date Format
Admin > Settings > General > Time Format

I am using the Any+Time jQuery plugin as a date/time selector for the editor view for a custom post type. It allows you to specify a date and time format using the same settings WordPress does. Edit: Turns out it doesn’t use the same Date part tokens that WordPress does. Lame.

http://www.ama3.com/anytime/#AnyTime.Converter.format

Ideally I want to do something like this…

<?php 
  $wpDateFormat = get_admin_settings('DateFormat');
  // $wpDateFormat now holds something like "F j, Y"
?>

<script>
    $("#datetime").AnyTime_picker({
      format: '<?php echo $wpDateFormat ?>'
    );
</script>

What I don’t know is… is there such a function like get_admin_settings() ?

3

get_option('date_format');
get_option('time_format');

Leave a Comment