Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.mac.system > #90422
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Jolly Roger <jollyroger@pobox.com> |
| Newsgroups | comp.sys.mac.system, alt.comp.lang.applescript |
| Subject | Re: Applescript: date formatting |
| Date | 27 Mar 2016 16:34:49 GMT |
| Organization | People for the Ethical Treatment of Pirates |
| Lines | 53 |
| Message-ID | <dlqgd9Fef9rU1@mid.individual.net> (permalink) |
| References | <56f78c3b$0$29512$c3e8da3$c8b7d2e6@news.astraweb.com> |
| X-Trace | individual.net 5xwLoljNPJ9CFOPITIPs/Az44Iq+gW974iWYxgz+VbY8srQ3j1 |
| Cancel-Lock | sha1:oTdIK54G4pU/Mf4v+gXYiMQU6hM= |
| X-Face | _.g>n!a$f3/H3jA]>9pN55*5<`}Tud57>1<n@LQ!aZ7vLO_nWbK~@T'XIS0,oAJcU.qLM dk/j8Udo?O"o9B9Jyx+ez2:B<nx(k3EdHnTvB]'eoVaR495,Rv~/vPa[e^JI+^h5Zk*i`Q;ezqDW< ZFs6kmAJWZjOH\8[$$7jm,Ogw3C_%QM'|H6nygNGhhl+@}n30Nz(^vWo@h>Y%b|b-Y~()~\t,LZ3e up1/bO{=-) |
| User-Agent | slrn/1.0.1 (Darwin) |
| Xref | csiph.com comp.sys.mac.system:90422 alt.comp.lang.applescript:18 |
Cross-posted to 2 groups.
Show key headers only | View raw
On 2016-03-27, JF Mezei <jfmezei.spamnot@vaxination.ca> wrote:
>
> the following applescript:
> write "date: " & aPhoto's date & return to outfile
>
> produces:
> date: Tuesday, 10July, 2012 at 13:22:10
>
> Which is a useless date for more processing.
>
> So, is it a case of having to write some complex subroutine to generate
> a proper ISO date format with lots of string concatenation and
> truncation (I suspect I would have to add 100 to all values and then
> take the last 2 digits to get a leading 0 for values less than 10).
>
> Or is there something really simple which I have not found ?
[cross posted to alt.comp.lang.applescript]
-- begin script
return FormatDateTime(current date)
--------------------------------------------------------------------------------------------
on FormatDateTime(theDate)
set theDate to theDate as date
set D to characters -2 through -1 of ("0" & theDate's day) as
text
copy theDate to tempDate
set the month of tempDate to January
set M to characters -2 thru -1 of ("0" & 1 + (theDate - tempDate
+ 1314864) div 2629728) as text
set Y to characters -1 thru -4 of ((year of theDate) as text) as
text
set hh to "0" & theDate's hours as text
set hh to characters ((count of hh) - 1) through (count of hh)
of hh
set mm to "0" & theDate's minutes as text
set mm to characters ((count of mm) - 1) through (count of mm)
of mm
set ss to "0" & theDate's seconds as text
set ss to characters ((count of ss) - 1) through (count of ss)
of ss
return (Y & "-" & M & "-" & D & " @ " & hh & ":" & mm & ":" & ss
as text)
end FormatDateTime
-- end script
--
E-mail sent to this address may be devoured by my ravenous SPAM filter.
I often ignore posts from Google. Use a real news client instead.
JR
Back to comp.sys.mac.system | Previous | Next — Previous in thread | Find similar
Applescript: date formatting JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-03-27 03:31 -0400 Re: Applescript: date formatting JF Mezei <jfmezei.spamnot@vaxination.ca> - 2016-03-27 03:52 -0400 Re: Applescript: date formatting Siri Cruise <chine.bleu@yahoo.com> - 2016-03-27 05:00 -0700 Re: Applescript: date formatting Jolly Roger <jollyroger@pobox.com> - 2016-03-27 16:34 +0000
csiph-web