[Question]
  [
I honestly cannot believe that this is not a question yet on Code Golf, but....
Print the local time (with a.m. or p.m.) as a string to the console, preceded by "It's ".
Example:
```
Run code....
```
**Output:**
```
It's 12:32p.m.
```
Shortest code wins.
Code away!
### Leaderboard
```
var QUESTION_ID=57552,OVERRIDE_USER=42854;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"http://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
```
```
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
```
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>
```
  
[Answer]
## Bash, ~~39~~ 33 bytes
```
date "+It's %I:%M%P."|sed s/m/.m/
```
Wasted a bunch of chars because the spec requires `a.m.` or `p.m.` while `date` outputs `am` or `pm`. Thanks to @DigitalTrauma for saving 6 bytes!
This might not be very portable. It works on Ubuntu 15.04.
A solution that uses essentially the same method in Ruby~~, which is surprisingly the exact same length~~:
## Ruby, 39 bytes
```
$><<`date "+It's %I:%M%P"`[0..-3]+'.m.'
```
[Answer]
# AppleScript, 198
Because AppleScript. Because why not:
```
set AppleScript's text item delimiters to {":"," "}
set d to (current date)'s time string's every text item
"It's "&d's item 1&":"&d's item 2&string id ((d's item 4's first character's id)+32)&".m."
```
That was painful.
[Answer]
# PHP, ~~35~~ 33 bytes
Using the wrong tool for the job!
```
It's <?=trim(date('h:ia'),m)?>.m.
```
It simply removes the `m` at the end of `am` or `pm`, to allow to add the dots. The date comes as `00:00am`, and with `trim` it becomes `00:00a`.
---
**Old answer (PHP 5.4+ only):**
```
It's <?=date('h:i'),date(a)[0]?>.m.
```
This works because you can de-reference a value returned from a function. This isn't possible in PHP5.3 or older.
[Answer]
## Visual Basic 6 / VBA, ~~42~~ 41 bytes
```
MsgBox"It's "&Format(Now,"h:mma/p")&".m."
```
Using `MsgBox`, as VB6 does not have a console (unless you intercept the linking, link as a console executable, use some Windows API hacks, and do some other *dodgy* stuff).
[Answer]
# R, ~~68~~ ,~~59~~ ~~62~~ ~~60~~ 55
```
cat("It's",sub("m",".m",format(Sys.time(),"%I:%M%P.")))
```
(Thanks to @Alex.A. and @flodel for the comments) Takes the current system time (`Sys.time()`), formats it correctly using `%I:%M%P` combination, adds a dot at the end, and replaces the `m` with `.m.`.
[Answer]
# Julia, ~~74~~ ~~54~~ 43 bytes
```
print(strftime("It's %I:%M%P\b.m.",time()))
```
You can [try it online](http://goo.gl/4ZU9F8)!
The `time()` function returns the current time. When passed to `strftime` with the format `%I:%M%P`, this results in `HH:MMam/pm`, where the hours are per a 12-hour clock. We back up one character with `\b` to remove the `m`, leaving a trailing `a` or `p`, then tack `.m.` onto the end.
Saved **31 bytes** thanks to Glen O!
[Answer]
# Haskell, 135 bytes
```
import Data.Time.Format
import Data.Time.LocalTime
main=getZonedTime>>=putStr.(++".m.").init.formatTime defaultTimeLocale"It's %I:%M%P"
```
I found a much more amusing `main` that's five bytes longer:
```
getZonedTime>>=putStr.formatTime(TimeLocale[][]("a","p")""""""""[])"It's %I:%M%P.m."
```
Or 66 bytes on Unix:
```
import System.Cmd;main=system"date \"+It's %I:%M%P.\"|sed s/m/.m/"
```
[Answer]
# Pyth, ~~38~~ 36 bytes
```
s["It's "|%J.d6K12K\:.d7?gJK\p\a".m.
```
Saved 2 bytes thanks to @Jakube!
[Answer]
# MATLAB, 59 bytes
```
disp(sprintf('It''s%s\b.m.',lower(datestr(now,'HH:MMam'))))
```
> 
> It's 5:38p.m.
> 
> 
> 
If it's allowed to have a whitespace between time and a.m./p.m., then it could be as low as **52 bytes**:
```
disp(sprintf('It''s%s\b.m.',lower(datestr(now,16))))
```
> 
> It's 5:39 p.m.
> 
> 
> 
[Answer]
# Perl 5.10+, ~~58~~ 62 bytes
```
localtime=~/(..)(:..)/;say"It's ",$1%12||12,$2,$1>11?p:a,".m."
```
Must be run with the `-M5.010` command line flag to get `say`.
I didn't account for a couple of edge cases in my original solution (namely, `00:**` and `12:**`); fixed at a cost of 4 additional bytes.
## How it works
In scalar context, [`localtime`](http://perldoc.perl.org/functions/localtime.html) returns a string like this:
```
Sat Sep 12 03:13:22 2015
```
The minutes field is already zero-padded, which saves some bytes (in list context, `localtime` returns numbers instead of strings, so you have to pad them yourself).
Here it is ungolfed:
```
localtime=~/(..)(:..)/;  # Store hour in $1 and minutes in $2
say"It's ",              # Print "It's " followed by...
   $1%12||12,            # hour in 12-hour format
   $2,                   # minutes
   $1>11?p:a,            # "p" if hour > 11, otherwise "a"
   ".m."'                # ".m."
```
---
# Perl 5.14+, 57 bytes
(Just for fun, since it stretches the rules a bit.)
```
say"It's ",(strftime"%l:%M%P",localtime)=~s/m/.m./r
```
51 bytes + 6 bytes for `-MPOSIX`. Must also be run with the `-M5.010` command line flag to get `say`.
This solution is dependent on your locale, so will not work on all systems. It also uses the POSIX module, which might be stretching the definition of a "built-in", even though it is a core module.
Perl 5.14+ is required for the non-destructive `r` modifier to the substitution operator. An equivalent solution that works on 5.10+ is:
```
$_=strftime"%l:%M%P",localtime;chop;say"It's $_.m."
```
This is also 57 bytes (51 bytes + 6 bytes for `-MPOSIX`).
[Answer]
# Perl 5, 74 bytes
A small showcase of how the variables are evaluated from right to left. 
```
($s,$m,$h)=localtime;printf"It's %d:%02d%s.m.",$h<13?$h:$h%12,$m,$h<12?a:p
```
### Using POSIX: 80 bytes
```
use POSIX;$_=strftime"It's %I:%Mx.m.",@_=localtime;$x=$_[1]<13?a:p;s/x/$x/;print
```
### Using POSIX with time locale dependence & switches : 54 bytes (48 + 6)
```
$_=strftime"It's %I:%M%P",localtime;s/m/.m./;say
```
**Test**
```
$ export LC_TIME="en_DK.UTF-8"
$ perl -MPOSIX -M5.01 whatsthetimechap.pl
It's 3:09p.m.
```
[Answer]
# CJam, 40 bytes
```
"It's "et3=CmdCe|\'p'a?':et4=s2Ue[@".m."
```
Try it online in the [CJam interpreter](http://cjam.aditsu.net/#code=%22It's%20%22et3%3DCmdCe%7C%5C'p'a%3F'%3Aet4%3Ds2Ue%5B%40%22.m.%22).
### How it works
```
"It's " e# Push that string.
et3=    e# Select the fourth element of the date/time array (hours).
Cmd     e# Push quotient and remainder of the hour divided by 12.
Ce|     e# Logical OR with 12 to map 0 to 12.
\'p'a?  e# Select 'p' if the quotient is 1 and 'a' if it is 0.
':      e# Push that character.
et4=    e# Select the fifth element of the date/time array (minutes).
s2Ue[   e# Cast to string and left-pad with zeroes to a length of 2.
@".m."  e# Rotate 'a' or 'p' on top of the stack and push ".m.".
```
[Answer]
# Mathematica ~~49 90 92 90~~ 84 bytes
-6 bytes thanks to user202729
The solution is straightforward, but a bit wordy, in Mathematica.
```
(d=DateString)@{"It's ","Hour12",":","Minute"}<>(d@"AMPM"/."AM"->"a.m."/."PM"->"p.m‌ .")
```
[Answer]
# T-SQL (2012+), ~~67~~ 65 bytes
SQL Server 2012 finally gave us a reasonable formatting function for dates. I still had to muck around with the AM/PM to get the format right though.
```
PRINT 'It''s '+LOWER(STUFF(FORMAT(GETDATE(),'hh:mmtt.'),7,0,'.'))
```
In previous versions it would have needed something like this (93 bytes)
```
PRINT'It''s'+LOWER(STUFF(STUFF(RIGHT(CONVERT(VARCHAR,GETDATE(),109),15),6,7,''),8,0,'.'))+'.'
```
[Answer]
# PHP, 49 bytes
If only it were `am/pm` instead of `a.m./p.m.`...
```
It's <?=@preg_replace(~Ð¤ž’¢Ð,~ÛÏÑ,date(~˜Å–ž));
```
I used a lot of nasty bytes to save a bit of length so here's the hex:
```
00000000: 49 74 27 73 20 3C 3F 3D - 40 70 72 65 67 5F 72 65 |It's <?=@preg_re|
00000010: 70 6C 61 63 65 28 7E D0 - A4 9E 92 8F A2 D0 2C 7E |place(~       ,~|
00000020: DB CF D1 2C 64 61 74 65 - 28 7E 98 C5 96 9E 29 29 |   ,date(~    ))|
00000030: 3B                      -                         |;|
00000031;
```
Readable version:
```
It's <?=preg_replace("/[amp]/", "$0.", date("g:ia"));
```
[Answer]
# C, 103 94 bytes
```
int main(){time_t r;char b[80];time(&r);strftime(b,80,"It's %I:%M %p",localtime(&r));puts(b);}
```
**Ungolfed**
```
int main()
{
  time_t r;
  char b[80];  
  time(&r);
  strftime(b,80,"It's %I:%M %p",localtime(&r));
  puts(b);
}
```
[Answer]
# PHP, 41 bytes
`It's <?=strtr(date('g:ia'),['m'=>'.m.']);`
First time I've played this. Not sure if I'm supposed to update/edit the previous PHP answer (49 bytes) or just add my own...
[Answer]
# SQL (PostgreSQL), ~~42~~ 41 bytes
Another SQL variant, however this one is in a query.
```
select to_char(now(),'"It''s" HH:MIa.m.')
```
As a note either p.m. or a.m. works to get the am/pm part. The formatting options in PostgreSQL are really quite flexible.
Thanks to @manatwork for the tip to move the `it's` into the format string.
[SQLFiddle](http://sqlfiddle.com/#!15/9eecb7db59d16c80417c72d1e1f4fbf1/3173/0)
[Answer]
# Javascript, 103 bytes
Javascript executed from the console.
```
d="It's "+new Date().toLocaleTimeString();l=d.length;d.slice(0,l-6)+d.slice(-2,l-1).toLowerCase()+'.m.'
```
# C#, 63 bytes
C# executed from the immediate window.
```
?"It's "+System.DateTime.Now.ToString("h:MMt").ToLower()+".m.";
```
[Answer]
# Bash, 44 characters
Pure Bash, just shell builtins, no \*\*\*utils.
```
printf -vt "It's %(%I:%M%P)T"
echo ${t%m}.m.
```
Sample run:
```
bash-4.3$ printf -vt "It's %(%I:%M%P)T";echo ${t%m}.m.
It's 01:04p.m.
```
[Answer]
# Powershell, 49 bytes
```
"It's {0:hh:mm}$("ap"[($d=date).hour/23]).m."-f$d
```
`(date).hour/23` seems to work as an index for `"ap"` because it rounds to `0` for hours less than 12 and `1` for 12 and above.
[Answer]
# Locale-dependent
For browser environments that have the locale set to `en-CA` or any locale that outputs a 12-hour time by default:
## CoffeeScript, 81 bytes
```
alert "It's #{(x=(new Date).toLocaleTimeString().toLowerCase())[..4]} #{x[9]}.m."
```
## JavaScript (ES5), 90 bytes
```
alert("It's "+(x=(new Date).toLocaleTimeString().toLowerCase()).slice(0,5)+' '+x[9]+".m.")
```
# Locale-independent
## CoffeeScript, ~~113~~ 96 bytes
```
alert "It's #{(h=(d=new Date).getHours())%12}:#{('0'+d.getMinutes())[-2..]} #{'ap'[+(h>11)]}.m."
```
Previous:
This one works in all browser environments regardless of locale. Requires Chrome 24+, Firefox 29+, IE 11+, Opera 15+ or any derivatives of such. Does not work in Safari. See [`Intl.DateTimeFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
```
alert "It's #{new Intl.DateTimeFormat('en',{hour:f='2-digit',minute:f}).format(new Date).toLowerCase()[..-2]}.m."
```
[Answer]
## **Swift - 124 102 bytes**
```
import Cocoa
var f=NSDateFormatter()
f.dateFormat="hh:mma"
print("It's \(f.stringFromDate(NSDate()))")
```
[Answer]
# C, 154 bytes
```
#include <time.h>
#define l localtime(&r)
main(){time_t r=time(0);printf("It's %02i:%02i%c.m.",(l->tm_hour+11)%12+1,l->tm_min,(l->tm_hour>=12)?'p':'a');}
```
In contrast to the other C answer, this one uses the correct "a.m."/"p.m." format. The other poster omitted `#include <time.h>` – if your compiler allows this, we get down to 136 bytes. Which one should we count?
[Answer]
## Moonscript - 56 bytes
```
print "It's "..(os.date'%I:%M%p'\gsub 'M','.M.')\lower!
```
Unfortunately the Lua standard library only implements %p for uppercase AM/PM, so I have to call the method lower.
[Answer]
# SpecBAS - 64 bytes
```
PRINT "It's ";LOW$(REPLACE$(TIME$(TIME,"h:mm p$"),"M",".M."))
```
The built-in `p$` of the time function returns AM or PM, so this then has to be formatted with `REPLACE$` to change it so it has a full stop before/after that letter.
Then the time output had to be converted to lowercase.
[Answer]
# MATLAB, 66 bytes
```
['It''s' lower(datestr(now,'HH:MMam'))];disp([ans(1:end-1),'.m.'])
```
Displays:
```
It's 2:48p.m.
```
[Answer]
# Python 2, ~~75~~ ~~67~~ 66 bytes
```
import time;print"It's %s.m."%time.strftime("%I:%M%p")[:6].lower()
```
old version, 75 bytes
```
import time
t=time.strftime("%I:%M%p")
print"It's",t[:5]+t[5].lower()+".m."
```
old version, 75 bytes
```
import time
print"It's",time.strftime("%I:%M%p").lower().replace("m",".m.")
```
[Answer]
# Python 3, ~~117~~ ~~87~~ 79 bytes
```
from datetime import*
print(datetime.now().strftime("It's %I:%M%P")[:-1]+".m.")
```
This gets the hours and minutes from a 12-hour clock using the format `%I:%M`, plus `am` or `pm` using `%P`. We then select everything but the last `m` and append `.m.`.
Saved a few bytes thanks to Ruth Franklin!
[Answer]
# AutoIt, 73 bytes
Even though AutoIt is generally a verbose language, this is quite short (converts time from 24h format):
```
$h=@HOUR>12
ConsoleWrite("It's "&@HOUR-12*$h&":"&@MIN&($h?"p":"a")&".m.")
```
# [ß](https://github.com/minxomat/-S-), 56 bytes
```
H=@HOUR>12µ€"It's "&@HOUR-12*H&":"&@MIN&H?"p.m.":"a.m.")
```
]