Jump to content
Sign in to follow this  
sbrady

transfer date to string

Recommended Posts

sbrady

if I use _NowDate () it returns 10/11/2012

I need this format 10-11-12

how do I do this. Thanks.

Share this post


Link to post
Share on other sites
FireFox

Hi,

With the String functions, like StringReplace and StringMid

Br, FireFox


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
sbrady

if I use _NowDate (), is the result a date format or is it really just a string of text that I can manipulate any way I want.

Share this post


Link to post
Share on other sites
Melba23

sbrady,

Malkey's _Date_Time_Convert UDF is a good place to start. :)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
kylomas

sbrady,

yes, the result is a string in date format as demonstrated by this code

;
;
;
#include <date.au3>
local $date = _nowdate()
consolewrite('!>>>> ' & vargettype($date) & @lf)

If you are wondreing whether or not autoit uses any data other format to represent dates, then, not that I know of.

kylomas

edit: just learning english, make that "any other data"

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
FireFox

@sbrady

This is a boy searching for the functions in the help file ;)


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
kylomas

sbrady,

You should start by looking up each instruction in the Help file. You will quickly realize that you are in over your head. The next step is to read the autoit Wiki articles, and the autoit Help file, FROM THE BEGINNING!

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
Melba23

sbrady,

If you do not know the answers to your questions - and there is no reason why you should as we all began knowing nothing about AutoIt - and you want to learn, then reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here. :)

Once you have a better grasp on AutoIt syntax and structure, then I suggest you ask your question again - because at the moment all we will do is to confuse you more. ;)

kylomas,

Good advice. :thumbsup:

FireFox,

Being slightly less ascerbic when replying to new users would be more helpful. ;)

M23

Edited by Melba23
Typo

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______Open Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
sbrady

I am not a programmer coder guy........I do audio and video production, but. I was able to teach myself Applescript on the Mac. The people on Apple forums were all very helpful. Yes it took me years to get to the point where I could get Applescript to do what I need. So here I am. I have written 80+ Applescripts that I use on my work computer to manage all my files and folders. It cuts out 95% of the clicking, opening, moving, sizing, copying, finding. No one on planet earth knows how cool my work life is due to Applescript. Now my work is going BACK to PC.......yes for me its a nightmare. I will have to throw away my reputation for being lightning fast and accurate. The comments to me are........lock yourself in a closet and read and learn the manual. I had the same problem with Applescript. I needed a kind soul to teach me and help fill in the blanks, and I found that on the Apple's Applescript forums. There is a difference between Mac and PC. I'll figure it all out...........eventually. Thanks for any offers to help.

Share this post


Link to post
Share on other sites
kylomas

sbrady,

You will find help here comensurate with your efforts. Not knowing your background, we gave you the simplest advice possible.

Good Luck,

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
FireFox

FireFox,

Being slightly less ascerbic when replying to new users would be more helpful. ;)

mouhaha, I find this funny :idiot: This was a bad joke. Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
UEZ

Here 3 examples which came to my mind yet:

$sDate = "10/11/2012"

$sString1 = StringLeft($sDate, 2) & "-" & StringMid($sDate, 4, 2) & "-" & StringRight($sDate, 2)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sString1 = ' & $sString1 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$sString2 = StringLeft(StringReplace($sDate, "/", "-"), 6) & StringRight($sDate, 2)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sString2 = ' & $sString2 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$sString3 = StringRegExpReplace($sDate, "(d+)/(d+)/d{2}(d+)", "$1-$2-$3")
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sString3 = ' & $sString3 & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×