get date formated
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 31
- Joined: Sat Apr 01, 2017 5:15 pm
get date formated
im trying to get the date and time in a variable
that i can use as part of a filename that will not
have invalided character for a email attachment .
not seeing a format in the dict that uses underscores or dashes .
that i can use as part of a filename that will not
have invalided character for a email attachment .
not seeing a format in the dict that uses underscores or dashes .
Re: get date formated
What about:
...
replace ":" with "_" in your_date_variable
...
And/or:
...
replace "/" with "_" in your_date_variable
...
You get the picture.
...
replace ":" with "_" in your_date_variable
...
And/or:
...
replace "/" with "_" in your_date_variable
...
You get the picture.
Re: get date formated
Hi,
you could also try this:(shows some useful features ;-) )
Have fun!
you could also try this:
Code: Select all
convert the seconds to dateitems
put item 1 of it & format("%02s",item 2 of it) & \
format("%02s",item 3 of it) & format("%02s",item 4 of it) & \
format("%02s",item 5 of it) into myTS
put "DateItems: " & it & CR & "TimeStamp: " & myTS
Have fun!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!
Re: get date formated
Just use the urlencode function: http://livecode.wikia.com/wiki/URLEncode
Sunday%2C+April+9%2C+201711%3A39%3A43+AM
or
Sun%2C+9+Apr+2017+11%3A57%3A06+%2B0200
or even better:
1491731863
See http://livecode.wikia.com/wiki/Seconds
Code: Select all
put urlencode (THE LONG DATE & the LONG time )
Sunday%2C+April+9%2C+201711%3A39%3A43+AM
or
Code: Select all
put urlencode (THE internet DATE )
or even better:
Code: Select all
put the seconds
See http://livecode.wikia.com/wiki/Seconds
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: get date formated
A slightly different typing but same as yours:AxWald wrote:
you could also try this:(shows some useful features )Code: Select all
convert the seconds to dateitems put item 1 of it & format("%02s",item 2 of it) & \ format("%02s",item 3 of it) & format("%02s",item 4 of it) & \ format("%02s",item 5 of it) into myTS put "DateItems: " & it & CR & "TimeStamp: " & myTS
Have fun!
Code: Select all
convert the seconds to dateitems
put "DateItems: " & IT into R
get format( "TimeStamp: %4d%02s%02s%02s%02s", \
item 1 of IT, \
item 2 of IT, \
item 3 of IT, \
item 4 of IT, \
item 5 of IT )
put R &cr& IT
Regards,
Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
Re: get date formated
Guys, sometimes you are like: https://www.youtube.com/watch?v=2DmE8-Xg0Kg
Re: get date formated
Bonjour Thierry,
your last post was nothing that you had to delete!?
Best
Klaus
your last post was nothing that you had to delete!?
Best
Klaus